Skip to content

helm CLI incorrectly splits on commas even when quoted #1556

Closed

Description

@aegixx

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"

Activity

  1. rimusz commented on Nov 16, 2016

    @rimusz
    Contributor

    I can confirm got cut by this bug yesterday too

  2. aegixx commented on Nov 16, 2016

    @aegixx
    Author

    If someone can point me in the right direction (where in the code is this handled?) - I'll take a look at creating a PR. To me, it looks like an issue @ https://github.com/kubernetes/helm/blob/master/cmd/helm/install.go#L268

    If someone can confirm if I'm at least thinking correctly.

  3. technosophos commented on Nov 16, 2016

    @technosophos
    Member

    @aegixx That is the correct location. That whole parser needs to be rewritten to be more robust. There's another issue with dots being unescapable. A PR would be awesome.

  4. added this to the 2.0.1 milestone on Nov 16, 2016
  5. databus23 commented on Nov 18, 2016

    @databus23
    Contributor

    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.

  6. aegixx commented on Nov 19, 2016

    @aegixx
    Author

    Unfortunately this won't help for my issue. I'm setting environment variables that have a longer string that just happens to contain a comma. Multiple sets won't help with that specific issue. 

    --Bryan

    On Fri, Nov 18, 2016 at 5:40 PM -0600, "Fabian Ruff" [email protected] wrote:

    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.

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub, or mute the thread.

  7. databus23 commented on Nov 20, 2016

    @databus23
    Contributor

    @aegixx It would if splitting multiple values by commas would be removed completly in favour of specifying --set multiple times. That's what I meant. Looking at the other issues related to parsing the --set flag I think there are two options:

    1. Improve the parser considerably. I think that basically means implementing a "real" parser, something like LALR(1). Which also requires creating a lexer. I think working just with string splitting and/or regex matching is difficult to get right when an arbitrary amount for values is supported.
    2. Reduce the complexity by limiting the scope of --set to one value and just get the parsing of types and keys correct with regexes.
  8. technosophos commented on Nov 21, 2016

    @technosophos
    Member

    The unfortunate thing, @databus23, is that we can't break backward compatibility, and Option 2 would break the existing behavior.

  9. added 5 commits that reference this issue on Nov 22, 2016
    5d0b28f
    a7277cd
    9ea185e
    5eced02
    6a1aab7
  10. added a commit that references this issue on Nov 29, 2016
    1249ffd
  11. 2 remaining items

  12. whereisaaron commented on May 31, 2018

    @whereisaaron
    Contributor

    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?

  13. whereisaaron commented on May 31, 2018

    @whereisaaron
    Contributor

    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.

  14. kvolkovich-sc commented on Jul 31, 2018

    @kvolkovich-sc

    About the comma-separated key value pairs, having the option to turn comma-separation off would be nice, as we need to specify strings with multiple commas in them (eg. mongo connection strings), and escaping these from within shell scripts/CD tooling/environment variables can be a pain.

    @dsample®

  15. rcjsuen commented on Dec 9, 2018

    @rcjsuen

    Trying to define the cron schedule on the command line but this is making things more difficult than it needs to be. :(

  16. darkn3rd commented on Dec 22, 2020

    @darkn3rd

    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'
  17. FilBot3 commented on Sep 27, 2021

    @FilBot3

    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'

    Just spent 4 days beating my head against the desk to find this. I will try this next. I ended up writing out to a temp file then telling helm to use a second --values file. This does seem like it's still an issue.

  18. zerthimon commented on Oct 8, 2021

    @zerthimon

    got bitten by this too

  19. vpapidokha commented on Mar 23, 2022

    @vpapidokha

    Still in the same situation.

  20. FilBot3 commented on Mar 23, 2022

    @FilBot3

    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)

  21. vpapidokha commented on Mar 24, 2022

    @vpapidokha

    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.

  22. very-doge-wow commented on Mar 8, 2024

    @very-doge-wow

    Not quite sure how Nordix@54eb73b is supposed to fix this and I still encounter this issue when using helm v3.14.2.

    Is it just me?

  23. Yakuza-UA commented on Apr 23, 2024

    @Yakuza-UA

    Not quite sure how Nordix@54eb73b is supposed to fix this and I still encounter this issue when using helm v3.14.2.

    Is it just me?

    No, it’s not just you. I’ve just spent good few hours pulling my hair out in attempt to troubleshoot this. Everything worked in dev environment where I deploy using Docker Compose, but once I’ve pushed to Test AKS using helm… it stopped. Thought there was a problem with connectivity to LDAP server but it was a coma in a user DN. omg I can’t believe it

  24. danrspencer commented on Aug 12, 2024

    @danrspencer

    I just spent a while fighting this one myself, the best solution I found that I've not seen suggested yet is to echo out the YAML values and pipe it into Helm, e.g.

    echo -e "
    hello:
       world: earth,mars,jupiter
    " | helm install . --values -
    

    Annoying for setting a single values but if you're setting lots it's probably actually clearer than many --set flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions