简体   繁体   English

根据 Helm 图表的依赖设置值

[英]Set value in dependency of Helm chart

I want to use the postgresql chart as a requirements for my Helm chart.我想使用postgresql 图表作为我的 Helm 图表的要求。

My requirements.yaml file hence looks like this:因此,我的requirements.yaml文件如下所示:

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).在 postgreSQL Helm 图表中,我现在想使用属性postgresqlUsername设置用户名(有关所有属性,请参见https://github.com/helm/charts/tree/master/stable/postgresql )。

Where do I have to specify this property in my project so that it gets propagated to the postgreSQL dependency?我必须在我的项目中的什么地方指定此属性,以便它传播到 postgreSQL 依赖项?

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 containshttps://v2.helm.sh/docs/chart_template_guide/#subcharts-and-global-values中所述,在您的父级(即不是依赖项)图表的values.yaml文件中,有一个部分包含

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

That is, all values under the postgresql key will override the child ( postgresql ) chart's values.yaml values.也就是说, postgresql键下的所有值都将覆盖子 ( postgresql ) 图表的values.yaml值。 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 .请注意,如果您在requirements.yaml中将postgresql依赖项图表别名为另一个名称,则应使用该其他名称而不是postgresql

edit: The corresponding article in v3 is here https://helm.sh/docs/chart_template_guide/subcharts_and_globals/编辑:v3 中的相应文章在这里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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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