How to get the name of a child’s chart using Helm?

I have a steering chart that requires stable/redisas a child chart. The parent diagram must provide the redis service as an environment variable.

The red diagram includes a template with a name redis.fullname. How can I refer to this in my parent chart? That is, I want something like this in my parent deployment, but this does not work:

kind: Deployment
spec:
  template:
    containers:
        env:
        - name: REDIS_CLUSTER_SERVICE_HOST
          value: {{ template "redis.fullname" . }}
+8
source share
2 answers

You can use '{{.Release.Name }}-redis'in your parent chart. I had the same requirement. This is my example in case you want to take a look → https://github.com/kubernetes/charts/tree/master/incubator/distribution

+1

. - https://github.com/kubernetes/helm/blob/master/docs/chart_template_guide/subcharts_and_globals.md#sharing-templates-with-subcharts

, , :

redis.fullname (,.Values.commonVariable), , , , , .

:

{{- define "zookeeper.fullname" -}}
{{- printf "%s-%s" (.Values.component) (.Values.subcomponent) -}}
{{- end -}}

, zookeeper.fullname kafka (). .Values.component .Values.subcomponent , zookeeper (), .

-. , , . . - , {{.Release.Name }}-redis . .

- https://github.com/kubernetes/helm/issues/4314

+1

Source: https://habr.com/ru/post/1690438/


All Articles