<p>I have a long list of cronjobs that are common across all environments and short list which is specific to some markets.</p>

<p>As per the documentation of <a href="https://helm.sh/docs/chart_template_guide/control_structures/#ifelse" rel="nofollow noreferrer">if/else</a>, I can conditionally <strong>include</strong> blocks of text in the template. As the list to include is too large as most markets need it, I would prefer to exclude specific blocks.</p>

<p>As I am looping over a list of markets on a CronJob template, I am looking for an if/else condition to skip a particular iteration when the condition matches.</p>

<p>Something like:</p>

<pre><code>{{- range $job := $.Values.cronjobs }}
{{- range $markets := $.Values.markets }}
{{- if and (eq $job "special") (eq $markets "ordinary") }}
&lt;&lt;---skip templating the below block of code---&gt;&gt;
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  namespace: {{ $.Release.Namespace }}
[...]
{{- end }}
</code></pre>

Smruti Mandal
<p>You can negate the condition so that the block is only generated when it's false:</p>

<pre><code>{{- if not ( and (eq $job "special") (eq $markets "ordinary") ) }}
</code></pre>
