Menu

1 / 5

Kustomize patch env variable with valueFrom in a Helm chart

DEV Community: kubernetes·Moep90·1 day ago
#zF1S8kVI
#devtokubernetes#devto#dev#keda#crossplane
Reading 0:00
15s threshold

Many charts take extra environment variables as a map of names to values

and render each entry as name and value . A variable that comes from a

Secret, a ConfigMap or the downward API needs valueFrom , which such a map

cannot express. This post adds those entries to the rendered Deployments

instead, merged into the container by its name, first with a Kustomize

strategic merge patch over helm template , then with

Kapitan 's mutate

generator . The two cases come from open issues

against the KEDA HTTP add-on chart and the Crossplane chart.

Each patch was rendered from the chart version named in its section with

Helm 4.3.1, Kustomize 5.8.3, and Kapitan 0.36.3 with mutate 0.1.0, and the

result was installed on a kind cluster on Kubernetes 1.37.0. Both charts

come from HTTP chart repositories, and each downloaded package matched the

sha256 its repository's index.yaml lists.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.