Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set value in dependency of Helm chart

Tags:

I want to use the postgresql chart as a requirements for my Helm chart.

My requirements.yaml file hence looks like this:

dependencies:   - name: "postgresql"     version: "3.10.0"     repository: "@stable" 

In the postgreSQL Helm chart I now want to set the username with the property postgresqlUsername (see https://github.com/helm/charts/tree/master/stable/postgresql for all properties).

Where do I have to specify this property in my project so that it gets propagated to the postgreSQL dependency?

like image 643
Harold L. Brown Avatar asked Apr 18 '19 14:04

Harold L. Brown


People also ask

How do I change the value of a helm chart?

There are two ways to pass configuration data during install: --values (or -f ): Specify a YAML file with overrides. This can be specified multiple times and the rightmost file will take precedence. --set name=value : Specify overrides on the command line.

How does helm dependency work?

In Helm, one chart may depend on any number of other charts. These dependencies can be dynamically linked through the requirements. yaml file or brought in to the charts/ directory and managed manually.


1 Answers

As described in https://v2.helm.sh/docs/chart_template_guide/#subcharts-and-global-values, in your parent (i.e. not the dependency) chart's values.yaml file, have a section that contains

postgresql:   postgresUsername: ....   postgresPassword: ....   ... 

That is, all values under the postgresql key will override the child (postgresql) chart's values.yaml values. Note that if you have aliased the postgresql dependency chart to another name in your requirements.yaml, you should use that other name instead of postgresql.

edit: The corresponding article in v3 is here https://helm.sh/docs/chart_template_guide/subcharts_and_globals/

like image 118
jhanschoo Avatar answered Sep 27 '22 18:09

jhanschoo