Helm Chart Rendering (render-helm-chart)#
render-helm-chart is a KRM function in the krm-functions-catalog that renders local or remote Helm charts into Kubernetes manifests. It wraps helm template internally — no separate Helm binary installation is required by the caller .
The function integrates with any KRM orchestrator (kpt, kustomize). When used with kpt fn eval, remote charts require --network and local charts require --mount .
Chart Resolution: chartHome → Remote Fallback#
The core lookup logic lives in Generate():
- Local check —
chartExistsLocally()checks whether{absChartHome}/{name}is a directory on disk. If the directory exists, the local copy is used and no network call is made. - Remote pull — If the chart is not found locally, the function pulls it from the configured repository:
- Non-OCI repos:
pullNonOCIRepo()runshelm repo addthenhelm pull --untar --untardir {chartHome}. - OCI repos (
oci://prefix):pullOCIRepo()optionally runshelm registry login, thenhelm pull.
- Non-OCI repos:
- Template — After the chart is available locally,
helm templateis executed viatemplateArgs().
chartHome defaults to tmp/charts when not specified . When running inside a container, chartHome must have the tmp/ prefix because the function writes pulled charts to that path .
The absolute path used for all operations is resolved once via absChartHome() (filepath.Abs(p.ChartHome)).
FunctionConfig#
Two functionConfig kinds are supported :
ConfigMap#
Flat key-value pairs under data. Relevant fields:
| Field | Notes |
|---|---|
chartHome | Local chart directory; defaults to tmp/charts |
name | Chart name |
repo | Remote repo URL (e.g. https://itzg.github.io/minecraft-server-charts) |
version | Chart version |
releaseName | Replaces RELEASE_NAME in templates |
namespace | Target namespace |
includeCRDs | "true" to include CRDs |
valuesFile | Local or remote values file path |
RenderHelmChart (custom resource)#
Supports multiple charts in one function invocation via helmCharts[], plus a helmGlobals block for shared settings like chartHome and configHome .
Additional fields available only in RenderHelmChart:
registry— OCI registry URL forhelm registry loginauth— reference to aSecretwithdata.username/data.passwordfor private repos or registriesvaluesInline/valuesMerge— inline values and merge strategy (merge,override[default],replace)
Key Source Files#
| File | Purpose |
|---|---|
helmchartprocessor.go | Entry point; dispatches to HelmChartInflationGeneratorPlugin |
HelmChartInflationGenerator.go | Core logic: Generate(), chartExistsLocally(), pullNonOCIRepo(), pullOCIRepo() |
README.md | Full field reference and examples |
Examples (from README):