Skip to content

Can't remove keys defined in values.yml #1966

Closed

Description

@jagregory

Since the introduction of deep merging (#1620), it's now not possible to remove keys from values.yml entirely.

For example, the telegraf values has a default entry for single.config.inputs.influxdb (see: L340). There's no way to completely remove this key through --set or a override file.

Telegraf values.yml

single:
  config:
    inputs:
      influxdb:
        urls:
          - "http://influxdb-influxdb.tick:8086/debug/vars"
        timeout: "5s"

My telegraf-overrides.yml

single:
  config:
    inputs:
      influxdb: null # or something?

Activity

  1. added this to the milestone on Feb 17, 2017
  2. technosophos commented on Feb 17, 2017

    @technosophos
    Member

    Yeah, this appears to be true. Any suggestions about how we might support that?

  3. jagregory commented on Feb 17, 2017

    @jagregory
    Author

    A few options come to mind:

    • A flag to indicate the values you're supplying replace the values from the chart. helm install -f my-values.yml --overwrite
    • A special value in the yaml to indicate not to merge, perhaps a null. e.g. Null means delete this key

    Meta: the reason this is a problem is because Telegraf doesn't have an explicit enabled property you can set, so the presence of a value is significant.

    We could work around this by adding our own enabled key under influxdb, and check for the presence that in the templating and not write out the node; but this puts the onus on each chart to get it right.

    More meta: I've also been thinking about whether we should be trying to generate config files from YAML in the first place. Several charts (the Influx stack in particular) allow you to specify configs in YAML which get translated into TOML, this translation is quite complicated and I suspect we're losing some information in translation. Each chart is having to do this itself. It might be better to just not try to do this at all, have the ConfigMap contain non-generated TOML which you can just pass your own in wholesale. Most of the time I already have a config file I want to use, and translating it to YAML is arduous (though I appreciate being able to abstract away complicated configs).

  4. jagregory commented on Feb 17, 2017

    @jagregory
    Author

    Prior art for my last little ramble: grafana.ini

  5. technosophos commented on Feb 17, 2017

    @technosophos
    Member

    I wouldn't be opposed at all to an --overwrite flag. That makes sense.

    Some work did make it into Helm 2.2.0 which will allow subcharts to be switched on and off based on conditions. But it will likely take the charts repository a while to catch up on those.

  6. added
    help wanted
    on Feb 17, 2017
  7. scottrigby commented on Jul 5, 2017

    @scottrigby
    Member

    Hey guys, just coming to this now. We were just brainstorming about this problem in Slack Today. And just as I was about to create an issue, I looked and found this one 😄

    So I prefer the null option, over --overwrite, because that could change more than we need. The immediate problem I see with an --overwrite flag is that would change the deep nesting behavior of all the keys/values from #1656 (helm install some/chart -f values1.yaml -f values2.yaml --set foo.bar=baz. I would think we want to be able to target specific keys, otherwise lots of breakage may happen. Whereas we could just add one check for a null value during the Helm deep nesting logic, and in that case nix the key.

  8. jascott1 commented on Jul 5, 2017

    @jascott1
    Contributor

    I also like the null option and using it with helm init --set would allow advanced users to completely remove keys (e.g. the default nodeSelector that specifies linux) and have more control of the Tiller Deployment manifest.

  9. thomastaylor312 commented on Jul 6, 2017

    @thomastaylor312
    Contributor

    @scottrigby So I was looking at the code as it stands without your PR. It looks like ~ indicates null in YAML. I was able to overwrite any key using that notation. However, with that said, it won't actually delete the key, it will just set its value to null. So I think your PR is a better option because it actually deletes the key from the map

  10. technosophos commented on Jul 6, 2017

    @technosophos
    Member

    Yeah, I too prefer an explicit null.

  11. technosophos commented on Jul 6, 2017

    @technosophos
    Member

    If ya'll agree, could we add this to 2.6 under the "stability and security" heading?

  12. thomastaylor312 commented on Jul 6, 2017

    @thomastaylor312
    Contributor

    Yes, I agree and already labeled the PR as such 😄

  13. thomastaylor312 commented on Jul 7, 2017

    @thomastaylor312
    Contributor

    Closed in #2648

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

    featurehelp wanted

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions