<p>So I got an environmental variable in my Helm chart which works fine when I'm running a <code>--dry-run</code>. However, when I'm trying to release it for real an error is thrown.</p>

<p>Because the amount of Postgres nodes differs based on the user's input in values.yaml I need a way to generate the partner nodes variable based on the number of nodes specified. </p>

<p>What I tried to do is create a loop that iterates over the numbers using the <code>until</code> function which returns a list of integers beginning with 0 and ending with $until-1 where I give the postgres_nodes value as input number like so:</p>

<pre><code>- name: "PARTNER_NODES"
value: "{{ range $i, $e := until ( int $.Values.postgres_nodes ) }}{{ if $i }},{{ end }}{{ $.Values.name }}-db-node-{{ $i }}.{{ $.Values.name }}-db{{ end }}"
</code></pre>

<p>When ran as <code>helm install --dry-run --debug</code> it works fine and a configuration file gets printed correctly:</p>

<pre><code>"xxx-db-node-0.xxx-db,xxx-db-node-1.xxx-db,xxx-db-node-2.xxx-db"
</code></pre>

<p>but when I remove the <code>--dry-run</code> to deploy it for real the following error gets thrown:</p>

<pre><code>Error: release ha-postgres failed: StatefulSet in version "v1beta1" cannot be handled as a StatefulSet: v1beta1.StatefulSet.Spec: v1beta1.StatefulSetSpec.Replicas: readUint32: unexpected character: �, error found in #10 byte of ...|eplicas":"3","servic|..., bigger context ...|-node","namespace":"default"},"spec":{"replicas":"3","serviceName":"boost-db","template":{"metadata"|...
</code></pre>

<p>Any help would be much appreciated, and thanks in advance.</p>

user10075632
<p>Turned out I had my replicas between quotation marks resulting in this error. </p>
