<p>I'd like to allow our developers to pass dynamic arguments to a helm template (Kubernetes job). Currently my arguments in the helm template are somewhat static (apart from certain values) and look like this </p>

<pre><code>      Args:
        --arg1
        value1
        --arg2
        value2
        --sql-cmd
        select * from db
</code></pre>

<p>If I were run a task using the docker container without Kubernetes, I would pass parameters like so:</p>

<pre><code>docker run my-image --arg1 value1 --arg2 value2 --sql-cmd "select * from db"
</code></pre>

<p>Is there any way to templatize arguments in a helm chart in such way that any number of arguments could be passed to a template.</p>

<p>For example.</p>

<pre><code>cat values.yaml
...
arguments: --arg1 value1 --arg2 value2 --sql-cmd "select * from db"
...
</code></pre>

<p>or </p>

<pre><code>cat values.yaml
...
arguments: --arg3 value3
...
</code></pre>

<p>I've tried a few approaches but was not successful. Here is one example: </p>

<pre><code>     Args:          
      {{  range .Values.arguments }}
        {{ . }}
      {{ end }}
</code></pre>

<p>Yes. In <code>values.yaml</code> you need to give it an array instead of a space delimited string.</p>

<pre><code>cat values.yaml
...
arguments: ['--arg3', 'value3', '--arg2', 'value2']
...
</code></pre>

<p>or</p>

<pre><code>cat values.yaml
...
arguments:
- --arg3
- value3
- --arg2
- value2
...
</code></pre>

<p>and then you like you mentioned in the template should do it:</p>

<pre><code>     args:          
      {{  range .Values.arguments }}
        - {{ . }}
      {{ end }}
</code></pre>

<p>If you want to override the arguments on the command line you can pass an array with <code>--set</code> like this:</p>

<pre><code>--set arguments={--arg1, value1, --arg2, value2, --arg3, value3, ....}
</code></pre>
