How to set multiple argument with postgress helm 3.0

3/25/2020

I want to set slave.extraVolumes as below.

helm install my-db --set replication.enabled=true,slave.extraVolumes={"db-disk-1","db-disk-2"} bitnami/postgresql -n development

But it says a error

Error: expected at most two arguments, unexpected arguments: bitnami/postgresql

Already tested ways:

helm install my-db --set replication.enabled=true,slave.extraVolumes={db-disk-1,db-disk-2} bitnami/postgresql -n development
Error: expected at most two arguments, unexpected arguments: bitnami/postgresql

helm install my-db --set replication.enabled=true,slave.extraVolumes="db-disk-1\,db-disk-2" bitnami/postgresql -n development
Error: YAML parse error on postgresql/templates/statefulset-slaves.yaml: error converting YAML to JSON: yaml: line 115: could not find expected ':'
-- Padmasankha
helmfile
kubernetes
kubernetes-helm

1 Answer

3/25/2020

There are (at least) three things going on:

  • the slave.extraVolumes is a list of Volume structures, so just providing two names won't get it done
  • you are using characters that are meaningful to the shell without quoting them
  • but in the end it doesn't matter because you cannot represent complex structures using only --set syntax, you'll need --values with either a file or a process substitution
helm install my-db \
   --set replication.enabled=true \
   --values <(echo '{
      "slave": {
        "extraVolumes": [
          {
            "name": "db-disk-1",
            "emptyDir": {}
          },
          {
            "name": "db-disk-2",
            "emptyDir": {}
          }
        ]
      }
   }') \
   bitnami/postgresql -n development
-- mdaniel
Source: StackOverflow