First, a little context: I have 4 Kubernetes clusters, one for each environment (develop, staging, testing, prod). Each cluster has its own values.yaml file with env-specific configuration of all helm charts that we've written.
So, when our CD pipeline deploys mychart to the develop cluster, it essentially does the following:
helm install -f base-values.yaml -f develop-values.yaml ./mychart.tgz
Now, let's presume mychart has a requirements.yaml file which specifies the mongodb chart as a subchart dependency. The mongodb chart references, for example, .Values.mongodbRootPassword. When included as a subchart by mychart, I can set .Values.mongodb.mongodbRootPassword in mychart's default values.yaml to change this value.
My problem is that given my current CD pipeline, if I set .Values.mongodb.mongodbRootPassword in develop-values.yaml, it will be taken for all mongodb instances that are deployed to the develop cluster - not just mychart's.
So, my questions:
- using per-environment
values.yamlfiles, how would I go about settingmychart's mongodb's root password in one of the cluster-specificvalues.yamlfiles? - is this even possible? Or is my current CD approach (per-environment values files) an anti-pattern?
- 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?