<p>Is it possible to have some sort of condition check before declaring a variable in a helm chart for deployment?</p>

<p>For example lets say I have </p>

<pre><code>        - name: EXAMPLE_VAR
          valueFrom:
            secretKeyRef:
              name: "name"
              key: "key"
</code></pre>

<p>but I only want to include this in my deployment for a specific configuration (based on lets say an environment variable) and don't want to have to maintain a seperate yaml configuration just for this configuration option</p>

Jared
<p>Let's say you have this in your chart's values.yaml</p>

<pre><code>some-condition: true
</code></pre>

<p>Then in deployment template you may do like that:</p>

<pre><code>spec:
  env:
  {{- if .Values.some-condition }}
  - name: EXAMPLE_VAR
    valueFrom:
      secretKeyRef:
        name: "name"
        key: "key"
  {{- end }}
</code></pre>
