<p>Using Helm templates, I'm trying to generate a list of server names based on a number in values.yaml.  The dot for this template is set to the number (its a float64).</p>

<pre><code>{{- define "zkservers" -}}
{{- $zkservers := list -}}
{{- range int . | until -}}
{{- $zkservers := print "zk-" . ".zookeeper" | append $zkservers -}}
{{- end -}}
{{- join "," $zkservers -}}
{{- end -}}
</code></pre>

<p>For an input of, say, 3 I'm expecting this to produce:</p>

<pre><code>zk-0.zookeeper,zk-1.zookeeper,zk-2.zookeeper
</code></pre>

<p>It produces nothing.</p>

<p>I understand that the line within the range block is a no-op since the variable $zkservers is a new variable each time the loop iterates. It is not the same variable as the $zkservers in the outer scope.</p>

<p>I hope the intention is clear of what I want to do. I am at a loss how to do it.</p>

<p>Anyone know how to do this with Helm templates?</p>

<p>For those from 2020+ it now can be achieved as simple as that:</p>

<pre><code>{{ join "," .Values.some.array }}
</code></pre>

<p>It produces the correct output:
<code>value: "test1,test2,test3"</code></p>

<p>At least it works with (more or less) recent versions of helm-cli:</p>

<pre><code>Client: &amp;version.Version{SemVer:"v2.16.2", GitCommit:"bbdfe5e7803a12bbdf97e94cd847859890cf4050", GitTreeState:"clean"}
</code></pre>
