github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/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  --image-pull-policy:
    54    If the image should be pulled before rendering the package(s). It can be set
    55    to one of always, ifNotPresent, never. If unspecified, always will be the
    56    default.
    57  
    58  --output, o:
    59    If specified, the output resources are written to provided location,
    60    if not specified, resources are modified in-place.
    61    Allowed values: stdout|unwrap|<OUT_DIR_PATH>
    62    1. stdout: output resources are wrapped in ResourceList and written to stdout.
    63    2. unwrap: output resources are written to stdout, in multi-object yaml format.
    64    3. OUT_DIR_PATH: output resources are written to provided directory.
    65       The provided directory must not already exist.
    66  
    67  --results-dir:
    68    Path to a directory to write structured results. Directory will be created if
    69    it doesn't exist. Structured results emitted by the functions are aggregated and saved
    70    to `results.yaml` file in the specified directory.
    71    If not specified, no result files are written to the local filesystem.
    72  ```
    73  
    74  #### Environment Variables
    75  
    76  ```
    77  KPT_FN_RUNTIME:
    78    The runtime to run kpt functions. It must be one of "docker", "podman" and "nerdctl".
    79  ```
    80  
    81  <!--mdtogo-->
    82  
    83  ### Examples
    84  
    85  <!--mdtogo:Examples-->
    86  
    87  ```shell
    88  # Render the package in current directory
    89  $ kpt fn render
    90  ```
    91  
    92  ```shell
    93  # Render the package in current directory and save results in my-results-dir
    94  $ kpt fn render --results-dir my-results-dir
    95  ```
    96  
    97  ```shell
    98  # Render my-package-dir
    99  $ kpt fn render my-package-dir
   100  ```
   101  
   102  ```shell
   103  # Render the package in current directory and write output resources to another DIR
   104  $ kpt fn render -o path/to/dir
   105  ```
   106  
   107  ```shell
   108  # Render resources in current directory and write unwrapped resources to stdout
   109  # which can be piped to kubectl apply
   110  $ kpt fn render -o unwrap | kubectl apply -f -
   111  ```
   112  
   113  ```shell
   114  # Render resources in current directory, write the wrapped resources
   115  # to stdout which are piped to 'set-annotations' function,
   116  # the transformed resources are written to another directory
   117  $ kpt fn render -o stdout \
   118  | kpt fn eval - -i gcr.io/kpt-fn/set-annotations:v0.1.3 -o path/to/dir  -- foo=bar
   119  ```
   120  
   121  ```shell
   122  # Render my-package-dir with podman as runtime for functions
   123  $ KPT_FN_RUNTIME=podman kpt fn render my-package-dir
   124  ```
   125  
   126  <!--mdtogo-->
   127  
   128  [declarative functions execution]:
   129    /book/04-using-functions/01-declarative-function-execution