I'm new to Helm.
I have a default value in parent chart. I want to use this value in each subchart by default, but also to have a possibility to override the value for a specific subchart.
Example:
# Parent-chart values.yaml
global:
schedule: 10m
All the subcharts will use this value by default. But if I run something like this:
helm install --set subchart-A.schedule="20m"
Subchart-A will use value "20m".
I'm thinking about two possibilities:
# Subchart values.yaml
schedule: {{ .Values.global.schedule }} # it doesn't work
In that case, it would be possible to override a specific value for the single subchart.
# Pseudocode:
if subchart.schedule is null
printf global.schedule
else
printf subchart.schedule
What would you do and what is generally possible?
Here is the documentation for reference.
You can specify defaults!
Example from the docs:
{{- with .Values.favorite }}
drink: {{ .drink | default "tea" | quote }}
food: {{ .food | upper | quote }}
release: {{ .Release.Name }}
{{- end }}
In your case, it would be something like:
{{ subchart-A.schedule | default .Values.global.schedule }}