<p>I want to implement a conditional template for Deployment resources through helm which can be enabled or disabled as per the environment. Something like the below which in not working. Or can we achieve the same through a different method.</p>
<pre><code>resources:
     enabled: true 
  requests:
     cpu: 100m
     memory: 128Mi
</code></pre>

<p>You can also check directly on <strong>resource</strong> value without adding the <strong>If</strong> <strong>condition</strong> or introducing a new variable in <code>values.yaml</code></p>
<pre><code>resources:
  {{- toYaml .Values.resources | nindent 12 }}
</code></pre>
<p><strong>values.yaml</strong> if values added in <code>values.yaml</code> they will get applied to the template else will get ignored.</p>
<pre><code>resources:
    limits:
      cpu: 100m
      memory: 128Mi
    requests:
      cpu: 100m
      memory: 128Mi
</code></pre>
<p><strong>Disable it</strong></p>
<pre><code>resources: {}
</code></pre>
<p>For ref : <a href="https://opensource.com/article/20/5/helm-charts" rel="nofollow noreferrer">https://opensource.com/article/20/5/helm-charts</a></p>
