简体   繁体   中英

Set value in dependency of Helm chart

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?

As described in https://v2.helm.sh/docs/chart_template_guide/#subcharts-and-global-values , in your parent (ie 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/

该主题在这里非常清楚地描述: https : //helm.sh/docs/developing_charts/#using-the-child-parent-format

可以在以下位置找到该问题的答案: https : //helm.sh/docs/chart_template_guide/#overriding-values-of-a-child-chart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM