github.com/SamarSidharth/kpt@v0.0.0-20231122062228-c7d747ae3ace/site/reference/cli/fn/render/README.md (about)

     1  ---
     2  title: "`render`"
     3  linkTitle: "render"
     4  type: docs
     5  description: >
     6    Render a package
     7  ---
     8  
     9  <!--mdtogo:Short
    10     Render a package.
    11  -->
    12  
    13  `render` executes the pipeline of functions on resources in the package and
    14  writes the output to the local filesystem in-place.
    15  
    16  `render` executes the pipelines in the package hierarchy in a depth-first order.
    17  For example, if a package A contains subpackage B, then the pipeline in B is
    18  executed on resources in B and then the pipeline in A is executed on resources
    19  in A and the output of the pipeline from package B. The output of the pipeline
    20  from A is then written to the local filesystem in-place.
    21  
    22  `render` formats the resources before writing them to the local filesystem.
    23  
    24  If any of the functions in the pipeline fails, then the entire pipeline is
    25  aborted and the local filesystem is left intact.
    26  
    27  Refer to the [Declarative Functions Execution] for more details.
    28  
    29  ### Synopsis
    30  
    31  <!--mdtogo:Long-->
    32  
    33  ```
    34  kpt fn render [PKG_PATH] [flags]
    35  ```
    36  
    37  #### Args
    38  
    39  ```
    40  PKG_PATH:
    41    Local package path to render. Directory must exist and contain a Kptfile
    42    to be updated. Defaults to the current working directory.
    43  ```
    44  
    45  #### Flags
    46  
    47  ```
    48  --allow-exec:
    49    Allow executable binaries to run as function. Note that executable binaries
    50    can perform privileged operations on your system, so ensure that binaries
    51    referred in the pipeline are trusted and safe to execute.
    52  
    53  --allow-network:
    54    Allow functions to access network during pipeline execution. Default: `false`. Note that this is applicable to container based functions only.
    55  
    56  --image-pull-policy:
    57    If the image should be pulled before rendering the package(s). It can be set
    58    to one of always, ifNotPresent, never. If unspecified, always will be the
    59    default.
    60  
    61  --output, o:
    62    If specified, the output resources are written to provided location,
    63    if not specified, resources are modified in-place.
    64    Allowed values: stdout|unwrap|<OUT_DIR_PATH>
    65    1. stdout: output resources are wrapped in ResourceList and written to stdout.
    66    2. unwrap: output resources are written to stdout, in multi-object yaml format.
    67    3. OUT_DIR_PATH: output resources are written to provided directory.
    68       The provided directory must not already exist.
    69  
    70  --results-dir:
    71    Path to a directory to write structured results. Directory will be created if
    72    it doesn't exist. Structured results emitted by the functions are aggregated and saved
    73    to `results.yaml` file in the specified directory.
    74    If not specified, no result files are written to the local filesystem.
    75  ```
    76  
    77  #### Environment Variables
    78  
    79  ```
    80  KPT_FN_RUNTIME:
    81    The runtime to run kpt functions. It must be one of "docker", "podman" and "nerdctl".
    82  ```
    83  
    84  <!--mdtogo-->
    85  
    86  ### Examples
    87  
    88  <!--mdtogo:Examples-->
    89  
    90  ```shell
    91  # Render the package in current directory
    92  $ kpt fn render
    93  ```
    94  
    95  ```shell
    96  # Render the package in current directory and save results in my-results-dir
    97  $ kpt fn render --results-dir my-results-dir
    98  ```
    99  
   100  ```shell
   101  # Render my-package-dir
   102  $ kpt fn render my-package-dir
   103  ```
   104  
   105  ```shell
   106  # Render the package in current directory and write output resources to another DIR
   107  $ kpt fn render -o path/to/dir
   108  ```
   109  
   110  ```shell
   111  # Render resources in current directory and write unwrapped resources to stdout
   112  # which can be piped to kubectl apply
   113  $ kpt fn render -o unwrap | kpt fn eval -i gcr.io/kpt-fn/remove-local-config-resources:v0.1.0 -o unwrap - | kubectl apply -f -
   114  ```
   115  
   116  ```shell
   117  # Render resources in current directory, write the wrapped resources
   118  # to stdout which are piped to 'set-annotations' function,
   119  # the transformed resources are written to another directory
   120  $ kpt fn render -o stdout \
   121  | kpt fn eval - -i gcr.io/kpt-fn/set-annotations:v0.1.3 -o path/to/dir  -- foo=bar
   122  ```
   123  
   124  ```shell
   125  # Render my-package-dir with podman as runtime for functions
   126  $ KPT_FN_RUNTIME=podman kpt fn render my-package-dir
   127  ```
   128  
   129  ```shell
   130  # Render my-package-dir with network access enabled for functions
   131  $ kpt fn render --allow-network
   132  ```
   133  
   134  <!--mdtogo-->
   135  
   136  [declarative functions execution]:
   137    /book/04-using-functions/01-declarative-function-execution