Skip to content

Builtin kustomize plugins

All standard kustomize transformers and generators are available as KRM functions via karmafun. Use apiVersion: builtin and set kind to the plugin name. The function config fields are identical to the kustomize built-in plugin fields.

Transformers

Kind Description Docs
AnnotationsTransformer Add / update annotations on resources
HashTransformer Append a content hash to resource names
ImageTagTransformer Update container image tags / digests
LabelTransformer Add / update labels on resources
NamespaceTransformer Set the namespace on all resources
PatchJson6902Transformer Apply RFC 6902 JSON patches
PatchStrategicMergeTransformer Apply strategic merge patches
PatchTransformer Apply JSON 6902 or strategic merge patches
PrefixTransformer Add a prefix to resource names
SuffixTransformer Add a suffix to resource names
PrefixSuffixTransformer Add prefix and suffix in one pass
ReplicaCountTransformer Update replica counts
ValueAddTransformer Add a value to a field
ReplacementTransformer Replace field values using sources (extended)
RemoveTransformer Remove resources by selector (custom)
KCLTransformer Transform resources with KCL code (custom)

Generators

Kind Description Docs
ConfigMapGenerator Generate ConfigMaps from literals / files / envs
SecretGenerator Generate Secrets from literals / files / envs
HelmChartInflationGenerator Render a Helm chart into plain resources
IAMPolicyGenerator Generate IAM policy documents
GitConfigMapGenerator ConfigMap populated with current git repo values (custom)
KustomizationGenerator Generate resources from a kustomization (custom)
SopsGenerator Decrypt SOPS-encrypted files into resources (custom)
KCLGenerator Generate resources from KCL code (custom)

Example: adding labels in-place

apiVersion: builtin
kind: LabelTransformer
metadata:
  name: add-labels
  annotations:
    config.karmafun.dev/cleanup: "true"
    config.kubernetes.io/function: |
      exec:
        path: karmafun
labels:
  app.kubernetes.io/managed-by: karmafun
fieldSpecs:
  - path: metadata/labels
    create: true
kustomize fn run --enable-exec --fn-path functions applications