<p>I have to run a command when my pod start in <code>kubernetes</code> which takes some argument but those argument are conditional. How to set those values. My configuration looks like</p>
<pre><code>#file: values.yaml
arguments:
  debug: false
  values: 16 # this is not necessarily set
</code></pre>
<pre><code>#deployment command section looks like
command: [ &quot;/bin/bash&quot;, &quot;-ce&quot;, &quot;./my_app.sh&quot; ]
args:
    - {{ -f .Values.arguments.debug }}
    - {{ -v .Values.arguments.values}}
</code></pre>
<p>But it seems to not accepting argument. Is this incorrect way. How can I pass multiple argument?</p>

<p>Helm uses the <a href="https://godoc.org/text/template" rel="nofollow noreferrer">Go <code>text/template</code> language</a> with a number of extensions; the Helm <a href="https://helm.sh/docs/chart_template_guide/getting_started/" rel="nofollow noreferrer">Chart Template Guide</a> has quite a few examples.</p>
<p>In particular the templating language includes an <code>if</code>...<code>else</code>...<code>end</code> construct.  You can use this like:</p>
<pre class="lang-yaml prettyprint-override"><code>args:
  - -f
  - {{ quote .Values.arguments.debug }}
{{- if .Values.arguments.values }}
  - -v
  - {{ quote .Values.arguments.values}}
{{- end }}
</code></pre>
<p>Note that the <code>-f</code> and <code>-v</code> text are outside the template curly braces, and I've split them out into separate items in the argument list.  In the last part there's a test if the <code>values</code> option is set, and the <code>-v</code> option isn't emitted if it's not.</p>
