0

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 ':'
David Maze
  • 130,717
  • 29
  • 175
  • 215
Padmasankha
  • 103
  • 1
  • 13

2 Answers2

4

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
  • 31,240
  • 5
  • 55
  • 58
2

For others who come from Google with the error message and want to solve that, rather than the obscure postgresql-specific answer in the accepted answer, the problem is almost certainly mdaniel's point 2 ("you are using characters that are meaningful to the shell without quoting them"), at least for modern bash.

This answer explains what is going on - Stop shell wildcard character expansion? - and how to fix it. Here you need to escape just the curly brackets, so something like:

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

or

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

Is what you need. The helm help is annoyingly silent on this.

AntonOfTheWoods
  • 809
  • 13
  • 17