I have a parent chart with 2 subcharts. The parent chart has global.myflag while the subcharts have myflag fields, in their respective values.yaml. I want the flexibility, where the sub-charts could be deployed independently. So, I have added a template function in the sub-chart _helper.tpl where I want to check - if global.myflag exists, use that value - else use value of myflag from the subchart
The template will return true/false. Something like this -
{{- define "isFlagEnabled" -}}
{{- $flag := false -}}
{{- if .Values.myflag -}}
{{- $flag := .Values.myflag -}}
{{- end -}}
{{- if .Values.global.myflag -}}
{{- $flag := .Values.global.myflag -}}
{{- end -}}
{{- printf "%s" $flag -}}
{{- end -}}
And using this value (true/false), I want to set some values in my config.yaml.
{{- if eq (value from template) true -}}
I am having two questions here - 1. Can we do 'if' condition on the template values? How? 2. Is there a better way to do this?