What is the best practice for overriding values in helm subcharts on a per-cluster basis?
- using per-environment
values.yaml
files, how would I go about settingmychart
's mongodb's root password in one of the cluster-specificvalues.yaml
files?
You can override YAML files with --set
option from install
Example:
helm install -f base-values.yaml -f develop-values.yaml --set someSection.someValue=1234 ./mychart.tgz
Then, you can set CI command call with environment settings and have just one YAML.
- is this even possible? Or is my current CD approach (per-environment values files) an anti-pattern?
Nope, that's a feature :-)
- if this is not possible or an anti-pattern, how would you go about setting the values of helm individual charts and subcharts on a per-environment basis?
It would be nice also. Perhaps, if your infrastructure grow fast and you have a lot of environments, apps or else, this could be better to manage.
I created a named template (within _helpers.tpl) that combined a set of default values defined in values.yaml with a set of env specific values defined in their own file. This allows me to set 20+ default values and then override them with the env file WITHOUT setting them as part of the cli command. I wanted to avoid using the cli to override values because that gets complicated and doesn't provide tracking (ie my env specific files are in git).