<p>I am using helm 3, and would like to concatenate 3 secretRefKeys into a single value of Env Var.</p>
<p>This is my cronjob.yaml file:</p>
<pre><code>apiVersion: batch/v1
kind: CronJob 
metadata:
  name: my-cronjob
spec:
  schedule: {{ .Values.cron }}
  jobTemplate:
    spec:
      template:
        spec:
          initContainers:
                - name: PREFIX
                  valueFrom:
                    secretKeyRef:
                      name: {{ .Values.secretName }}
                      key: prefix
                - name: ENV
                  valueFrom:
                    secretKeyRef:
                      name: {{ .Values.secretName }}
                      key: env
                - name: SUFFIX
                  valueFrom:
                    secretKeyRef:
                      name: {{ .Values.secretName }}
                      key: suffix
                - name: URL_FULL
                  value: $(PREFIX)$(ENV)$(SUFFIX)
          containers:
           .
           .
           .
           .
           .
</code></pre>
<p>I expect the value of <code>URL_FULL</code> to be the actual values of <code>prefix</code> <code>env</code> <code>suffix</code> concatenated.</p>
<p>But what I get with <code>helm template</code> command is literally what I write in the value:</p>
<pre><code>            - name: URL_FULL
              value: $(PREFIX)$(ENV)$(SUFFIX)
</code></pre>
<p>Thanks in advance.</p>

jrz
<p>That's correct; when you submit the pod spec to the Kubernetes API it will contain that literal string including the <code>$(...)</code> references (and also the <code>secretRef:</code> blocks and not the values of the secrets).</p>
<p>When Kubernetes creates the Pods and starts the containers, at that point the cluster itself will fill in all of the environment variables and do the string concatenation.  If this were a Deployment, you'd be able to verify this by running</p>
<pre class="lang-sh prettyprint-override"><code>kubectl exec deployment/my-deployment -it -- \
  sh -c 'echo $URL_FULL'
</code></pre>
<p>(In a Job or CronJob you'd probably have to instrument the service itself to see this.)</p>
