<p>Requirement: deploy multiple releases of chart A to single k8s namespace</p>

<p>I have a complex problem with subcharts name configuration. Relations between my charts are:</p>

<pre><code>A
|- B
   |- C
      |- D - postgres
      |- E - graphql-engine
|- F - postgres
|- G - graphql-engine
</code></pre>

<ul>
<li>A depends on B, F, G</li>
<li>B depends on C</li>
<li>C depends on D, E</li>
</ul>

<p>And the chart of type graphql-engine can requires zero or N variables based on application which for it is (if you know this app it should be backend URL, action URL, trigger URL etc.). In instance E the variables should points to aplication C and in instance G they should points to A.</p>

<p>I made Helm chart for graphql-engine with this part in Deployment`s container section:</p>

<pre><code>          env:
{{- range $k, $v := .Values.environmentVariables }}
            - name: {{ quote $k }}
              value: {{ quote "$v" }}
{{- end }}
</code></pre>

<p>To have a right names of subcharts I am doing this in A`s variables.yaml file:</p>

<pre><code>B:
  C:
    nameOverride: A-B-C
    D:
      nameOverride: A-B-C-D
    E:
      nameOverride: A-B-C-E
F:
  nameOverride: A-F
G:
  nameOverride: A-G
</code></pre>

<p>Default chart`s _helpers.tpl file prefixs nameOverride variable with .Release.Name variable.
It is not nice and optimal but I did not find a way to made this process to be dynamically created. Is here someone who knows better way to do this naming? That is my first question.</p>

<p>To simplify my problem. I need to put variable list like this:</p>

<ul>
<li><strong>VAR1="http://{{ .Release.Name }}-A-B-C:8080/graphql"</strong></li>
<li><strong>VAR2="http://{{ .Release.Name }}-A-B-C:8080/actions"</strong></li>
</ul>

<p>into E chart from A chart. But I did not find a way to let Go templating expand .Release.Name variable. I made this in A variables.yaml:</p>

<pre><code>B:
  C:
    nameOverride: A-B-C
    D:
      nameOverride: A-B-C-D
    E:
      nameOverride: A-B-C-E
      extraVariables:
        VAR1: "http://{{ .Release.Name }}-A-B-C:8080/graphql"
        VAR2: "http://{{ .Release.Name }}-A-B-C:8080/actions"
F:
  nameOverride: A-F
G:
  nameOverride: A-G
  extraVariables:
    VAR1: "http://{{ .Release.Name }}-A:8080/graphql"
</code></pre>

<p>But I did not find a way how to use tpl Helm function in range part with dollar variable input. Or another possibility to accomplish this. I tried just include some "template" which I can made in A chart but it had bad Vars context and is used in every graphql-engine chart instance and it is not right in this.</p>

<p>The real A application have more levels of dependencies but it is not important to this problem. Is this wrong way to do that? How are you creating names of k8s objects and how are you setting URL variables for you applications?</p>

<p>Thank you!</p>

Radim
<p>And answer to question about looping over list with tpl function calling is this. You just have to change context of tpl.</p>

<pre><code>{{- range $k, $v := .Values.environmentVariables }}
            - name: {{ quote $k }}
              value: {{ tpl $v $ }}
{{- end }}
</code></pre>
