Generate, transform, and validate configuration files.
Configuration Read From Configuration Written To
local files or stdin local files or stdout

Functions are executables (that you can write) which accept a collection of Resource configuration as input, and emit a collection of Resource configuration as output.

Functions can be packaged as container images, starlark scripts, or binary executables.

Functions may be used to:

  • Generate configuration from templates, DSLs, CRD-style abstractions, key-value pairs, etc.– e.g. expand Helm charts, JSonnet, Jinja, etc.
  • Inject fields or otherwise modify configuration – e.g.add init-containers, side-cars, etc
  • Rollout configuration changes across an organization – e.g.similar to https://github.com/reactjs/react-codemod
  • Validate configuration – e.g.ensure organizational policies are enforced

Functions may be run at different times depending on the function and the organizational needs:

  • as part of the build and development process
  • as pre-commit checks
  • as PR checks
  • as pre-release checks
  • as pre-rollout checks


# run the function defined by gcr.io/example.com/my-fn as a local container
# against the configuration in DIR
kpt fn run DIR/ --image gcr.io/example.com/my-fn
# run the functions declared in files under FUNCTIONS_DIR/
kpt fn run DIR/ --fn-path FUNCTIONS_DIR/
# run the functions declared in files under DIR/
kpt fn run DIR/

Using Functions

The [catalog] documents config functions implemented using different toolchains like starlark, typescript, and golang.

Developing Functions

See the Functions Developer Guide for more on producing functions.

Language Documentation Examples
Typescript Typescript SDK examples
Go Golang Libraries example
Shell Use builtin shell functions example
Starlark Starlark SDK example

Next Steps


Auto-generating function pipelines for different workflow orchestrators


Locally execute one or more functions in containers


Specify a directory as an output sink package


Specify a directory as an input source package