title: Helm - comma-separated list of dynamic strings
body: <p>Is it possible, within a <a href="/questions/tagged/helm" class="post-tag" title="show questions tagged &#39;helm&#39;" rel="tag">helm</a> chart to create a single string which is a comma-separated representation (similar to using the <code>",".join()</code> command in Python) of strings with a common prefix and a variable suffix?</p>
  
  <p>For example, I have a CLI application that requires an argument like so via the <code>extraArgs</code> parameter in a <a href="/questions/tagged/kubernetes" class="post-tag" title="show questions tagged &#39;kubernetes&#39;" rel="tag">kubernetes</a> pod definition:</p>
  
  <pre><code>extraArgs: &gt;-
    -M {{ $.Values.global.hostname }}/100
  </code></pre>
  
  <p>I now have to modify this value to be over a range (i.e. from <code>{{$.Values.global.minval}}</code> to <code>{{$.Values.global.maxval}}</code>, inclusive). So, for a <code>minval=100</code> and <code>maxval=105</code>, my chart needs to now become (note the lack of a trailing comma, and no spaces other than the space after <code>-M</code>):</p>
  
  <pre><code>extraArgs: &gt;-
    -M {{ $.Values.global.hostname }}/100,{{ $.Values.global.hostname }}/101,{{ $.Values.global.hostname }}/102,{{ $.Values.global.hostname }}/103,{{ $.Values.global.hostname }}/104,{{ $.Values.global.hostname }}/105
  </code></pre>
  
  <p>Is there some way I can execute this in a range/loop in my chart? I have several instances of this chart that will use different min/max values, and I'd like to automate this tedious task as much as I can (additionally, I <strong>do not</strong> have access to the app's source, so I can't change the CLI interface to the application).</p>
  
  <p>In Python, I could accomplish this roughly by:</p>
  
  <pre><code>minval = 100
  minval = 105
  s = "-M "
  L = []
  for i in range(minval, maxval+1):
      L.append("{{{{ $.Values.global.hostname }}}}/{}".format(i))
  s = s + ",".join(L)
  # print(s)
  </code></pre>
  
  <p>I'm not sure where to begin doing this in a Helm template beyond starting with the <code>range()</code> function.</p>