I am new to helm and I want to know how I can pass variables from the parent package to children. I have a multi microservices application which consists of different helm packages as below:
$ tree parent/
parent/
├── charts/
│ ├── child-A-0.0.1.tgz
│ ├── child-B-0.0.1.tgz
│ └── child-C-0.0.1.tgz
├── Chart.yaml
├── templates/
│ ├── NOTES.txt
│ └── secret.yaml
└── values.yaml
And for example, I want to set public-IP
in the parent values.yaml
and when I install the parent that public-IP
passed and set in the children as well.
Overriding values of a child chart is described in the Helm documentation.
In the parent chart's values.yaml
file (or an external file you pass to helm install -f
) you can explicitly override values for a subchart:
childA:
publicIP: 10.10.10.10
The top-level values key global
is also always passed to child charts, but the chart needs to know to look for it.
global:
publicIP: 10.10.10.10
env:
- name: PUBLIC_IP
value: {{ .Values.global.publicIP }}
This resolution happens fairly early in the Helm setup phase, so there's no way to pass a computed value to a subchart, or to pass the same value from the parent chart's top-level config into subcharts without restructuring things into global
.