Helm chart throws an error on release, but works fine on --dry-run

4/9/2019

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

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.

What I tried to do is create a loop that iterates over the numbers using the until 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:

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

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

"xxx-db-node-0.xxx-db,xxx-db-node-1.xxx-db,xxx-db-node-2.xxx-db"

but when I remove the --dry-run to deploy it for real the following error gets thrown:

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"|...

Any help would be much appreciated, and thanks in advance.

-- user10075632
kubernetes
kubernetes-helm
terraform

1 Answer

4/9/2019

Turned out I had my replicas between quotation marks resulting in this error.

-- user10075632
Source: StackOverflow