<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>

Hardik Panchal
<p>you can add condition in the deployment template</p>
<pre><code>{{- if .Values.resources_limit.enabled }}
    resources:
    {{- toYaml .Values.resources_limit.resources | nindent 12 }}
{{- end }}
</code></pre>
<p>and the value file should be like this</p>
<pre><code>resources_limit:
  enabled: true
  resources:
    limits:
      cpu: 100m
      memory: 128Mi
    requests:
      cpu: 100m
      memory: 128Mi
</code></pre>
<p>to disable, for example, <code>develop-values.yaml</code></p>
<pre><code>resources_limit:
  enabled: false
</code></pre>
