helmgen Tag Reference
helmgen compiles tagged YAML manifests into complete Helm charts. Each YAML tag maps to a Helm template construct.
!var <path>
Reference a .Values path. Optionally provide a default with = and pipes with |.
name: !var name
replicas: !var replicaCount=3
image: !var image.repository|quote Compiles to:
name: {{ .Values.name }}
replicas: {{ .Values.replicaCount | default 3 }}
image: {{ .Values.image.repository | quote }} !helm <expr>
Raw Helm/Go template expression passthrough. Use as an escape hatch for anything helmgen doesn't natively support.
namespace: !helm .Release.Namespace
version: !helm .Chart.AppVersion !helm-if '<expr>'
Wraps children in a raw {{- if expr }}...{{- end }} block. Used by the importer for complex if expressions that can't be converted to !when.
!helm-if 'and (.enabled) (gt (keys . | len) 1)':
securityContext:
!include my-chart.renderSecurityContext: Compiles to:
{{- if and (.enabled) (gt (keys . | len) 1) }}
securityContext:
{{ include "my-chart.renderSecurityContext" . }}
{{- end }} !helm-with '<expr>'
Wraps children in a raw {{- with expr }}...{{- end }} block. Used by the importer for complex with expressions that can't be converted to !when or !block.
!helm-with '(mergeOverwrite (deepCopy .Values.global.annotations) .Values.service.annotations)':
annotations:
!include my-chart.labels: Compiles to:
{{- with (mergeOverwrite (deepCopy .Values.global.annotations) .Values.service.annotations) }}
annotations:
{{ include "my-chart.labels" . }}
{{- end }} !helm-range '<expr>'
Wraps children in a raw {{- range expr }}...{{- end }} block. Used by the importer for complex range expressions that can't be converted to !each or !each-map.
!helm-range '$key, $value := .':
!helm $key: !helm $value | quote Compiles to:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }} !block / !block-forced
!block path wraps in with .Values.path + toYaml. !block-forced uses default dict to always emit.
resources: !block resources
tolerations: !block-forced tolerations !if / !else
Conditional on a .Values path being truthy.
hostNetwork: !if controller.hostNetwork
dnsPolicy: !else ClusterFirst !when
Conditional using an hx expression. Scalar form for single values, tagged-key form for wrapping multiple children.
# Scalar form
enableServiceLinks: !when 'controller.enabled and controller.exposeServices'
dnsPolicy: !else ClusterFirst
# Tagged-key form (wraps children)
!when 'int(replicaCount) > 1':
minReadySeconds: 30
strategy:
type: RollingUpdate !expr
Computed scalar value from an hx expression.
containerPort: !expr 'int(controller.containerPort)'
enabled: !expr 'controller.enabled ? "true" : "false"' !let
Bind a template variable from an hx expression. Must be used as a tagged key.
!let 'replicas=controller.replicaCount':
replicas: !expr '$replicas' Compiles to:
{{- $replicas := .Values.controller.replicaCount }}
replicas: {{ $replicas }} !each / !each-map
Range over a list or map from .Values.
# List
containers:
- !each:containers:item
name: !var item.name
image: !var item.image
# Map
annotations:
key: !each-map:annotations:k:v !include
Include a named Helm template partial.
labels: !include mychart.labels
name: !include mychart.fullname | trunc 63 !tpl
Evaluate a values path as a Go template.
annotations: !tpl annotations !required
Require a value, failing with a message if missing.
image: !required '"image.repository is required" image.repository' helmgen build
helmgen build -i manifests/ -o my-chart/ --name my-chart --version 1.0.0 Compiles tagged YAML manifests into a complete Helm chart with Chart.yaml, values.yaml, and templates.
helmgen validate
helmgen validate -i manifests/
helmgen validate -i manifests/ -v custom-values.yaml Full round-trip validation: compile → helm template → parse rendered YAML. Requires helm on PATH.
helmgen import
helmgen import -i my-chart/ -o helmgen-manifests/ Convert an existing Helm chart's Go templates into helmgen tagged YAML.