How to reference a value defined in a template in a sub-chart in helm for kubernetes?

前端 未结 2 485
暗喜
暗喜 2020-12-31 01:52

I\'m starting to write helm charts for our services.

There are two things I\'m not sure how they are supposed to work or what to do with them.

First: the rel

2条回答
  •  醉话见心
    2020-12-31 02:18

    Are you pulling in postgresql as a subchart of your chart (via your chart's requirements.yaml)? If so, both the postgresql (sub) chart and your chart will have the same .Release.Name - thus, you could specify your container's environment as

      env:
        - name: DB_HOST
          value: {{ printf "%s-postgresql" .Release.Name }}
    

    if you override postgresql's name by adding the following to your chart's values.yaml:

    postgresql:
      nameOverride: your-postgresql
    

    then your container's env would be:

      env:
        - name: DB_HOST
          value: {{ printf "%s-%s" .Release.Name .Values.postgresql.nameOverride }}
    

提交回复
热议问题