helm: helm CLI incorrectly splits on commas even when quoted

When using the helm command and overriding values using --set, if the key value contains a comma, the value is halted there.

I’m assuming the entire argument is being split on commas, regardless of escaping or quotes.

Testing:

$ helm install kubernetes-charts/mysql --set mysqlUser="test_mysqluser,blah,dee,dah" --dry-run --debug | grep test_mysqluser

RETURNS

          value: "test_mysqluser"

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 19 (7 by maintainers)

Commits related to this issue

Most upvoted comments

For anyone else coming up on this issue, there is a workaround by escaping the commas with a backslash:

https://github.com/kubernetes/helm/blob/master/docs/using_helm.md#the-format-and-limitations-of---set

Just as a side note, we still believe that this a very unintuitive behaviour that needs a fix. Our use case right now was LDAP credentials, which naturally contain commas, but it also seems very problematic for autogenerated passwords, that might accidentally contain a comma.

Although I couldn’t find any mention or example in the document, reading the improved parsing code (thanks @technosophos!), you can ‘escape’ a comma, e.g. pass\,word and bypass the splitting. So --set 'my.password=pass\,word' will work until the comma splitting can be deprecated.

This is not a good user experience. For an escape, I had to do something like this:

helm install dev dgraph/dgraph \
  --set alpha.extraEnvs[0].name=DGRAPH_ALPHA_WHITELIST \
  --set alpha.extraEnvs[0].value='10.0.0.0\/8\,172.16.0.0/12\,192.168.0.0\/16'

we can’t break backward compatibility

helm already breaks compatibility with the tiller, just bump major and fix this

got bitten by this too

Still in the same situation.

you should put your contents into a YAML file and provide it as an extra --values file. See: #1556 (comment)

Thanks a lot. I’ve escaped comas and this helped. It would be too harsh in my opinion to create a separate values file just for one parameter.

But I will be glad if someone will add the mention of this behavior to docs. Because I didn’t find specific info on this.

Just been banging my head against this with helm 2.8.2. You can now have multiple ‘–set’ arguments, so the old comma syntax can (or should) be deprecated. It was always clunky and I stopped using it as soon as multiple ‘–set’ worked. However it is still the case that as soon as I have a comma in the value helm splits it and borks the deployment. No amount of quoting seems to work around it.

Could we ensure we deprecate the commas (maybe with a warning message) in 2.9.x, and not include it in 3.x?

Instead of writing a better parser for handling the splitting accounting for quotes why not allow to specify --set multiple times? I realise this is a breaking change but would be cleaner and easier to maintain IMO.