Skip to content

Nested null values do not remove keys from sub-charts #9136

Closed

Description

@elliotkennedy

#2648 and #5184 allow for deletion of keys by setting null values in a values.yaml file. However it doesn't work for removing nested values in sub-charts, e.g.:

values.yaml:

kibana:
  resources:
    requests:
      cpu: 1000m
      memory: 2Gi
    limits:
      cpu: null
      memory: 2Gi

Chart.yaml:

apiVersion: v2
name: elastic
description: Elastic stack
type: application
version: 0.0.1
dependencies:
  - name: kibana
    version: 7.9.3
    repository: "@elastic"

Results in a deployment object with the base cpu limits:

...
resources:
  limits:
    cpu: 1000m
    memory: 2Gi
  requests:
    cpu: 1000m
    memory: 2Gi

Output of helm version:

version.BuildInfo{Version:"v3.4.1", GitCommit:"c4e74854886b2efe3321e185578e6db9be0a6e29", GitTreeState:"clean", GoVersion:"go1.14.11"}

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4", GitCommit:"d360454c9bcd1634cf4cc52d1867af5491dc9c5f", GitTreeState:"archive", BuildDate:"2020-12-04T15:20:33Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.10", GitCommit:"62876fc6d93e891aa7fbe19771e6a6c03773b0f7", GitTreeState:"clean", BuildDate:"2020-10-15T01:43:56Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.):

AWS/Kops

Activity

  1. Chili-Man commented on Dec 17, 2020

    @Chili-Man

    I've been running into this same exact issue with Helm version 3.2, 3.3, and 3.4 as well. I haven't found a good workaround to this issue yet;

  2. elliotkennedy commented on Dec 17, 2020

    @elliotkennedy
    Author

    I believe there are 2 similar issues preventing this from working, modifiying the chart object makes calls to CoalesceValues non-idempotent:

    1. See here - The call to dependencies.processImportValues is overwriting the null values in the subchart so subsequent calls to CoalesceValues do not remove the default key.

    2. See here - The reference to the value is copied directly to the values map, subsequent modifications of this object are applied to the chart, so subsequent calls to CoalesceValues do not remove the default key

  3. added 8 commits that reference this issue on Dec 17, 2020
  4. added
    bug
    on Dec 17, 2020
  5. wrdls commented on Jan 11, 2021

    @wrdls

    @mattfarina In case you need an easy reproducible case for this bug to be labeled as confirmed:

    I'm having the same issue with the Bitnami Redis chart when trying to set the podDisruptionBudget.maxUnavailable key. For this to work you need to be able to unset the minAvailable key as it's otherwise not a valid PDB spec.

    So with a parent chart like this:

    Chart.yaml

    apiVersion: v2
    name: redis
    version: 0.0.1
    dependencies:
      - name: redis
        version: 10.7.16
        repository: https://charts.bitnami.com/bitnami

    values.yaml

    redis:
      podDisruptionBudget:
        enabled: true
        minAvailable: null    # THIS DOES NOT WORK
        maxUnavailable: 1

    Output:

    % helm template redis . -s charts/redis/templates/pdb.yaml | kubectl apply --dry-run=server -f -
    The PodDisruptionBudget "redis" is invalid: spec: Invalid value: policy.PodDisruptionBudgetSpec{MinAvailable:(*intstr.IntOrString)(0xc038134280), Selector:(*v1.LabelSelector)(0xc0381342a0), MaxUnavailable:(*intstr.IntOrString)(0xc0381342e0)}: minAvailable and maxUnavailable cannot be both set

    Versions used:

    % helm version
    version.BuildInfo{Version:"v3.4.2", GitCommit:"23dd3af5e19a02d4f4baa5b2f242645a1a3af629", GitTreeState:"clean", GoVersion:"go1.15.6"}
    % kubectl version
    Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4", GitCommit:"d360454c9bcd1634cf4cc52d1867af5491dc9c5f", GitTreeState:"archive", BuildDate:"2020-11-25T13:19:56Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
    Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.15-gke.6000", GitCommit:"b02f5ea6726390a4b19d06fa9022981750af2bbc", GitTreeState:"clean", BuildDate:"2020-11-18T09:16:22Z", GoVersion:"go1.13.15b4", Compiler:"gc", Platform:"linux/amd64"}
  6. added 2 commits that reference this issue on Feb 26, 2021
  7. 63 remaining items

  8. LoicGombeaud commented on Oct 6, 2022

    @LoicGombeaud

    I just ran into this issue, and would very much appreciate a fix.

  9. added 2 commits that reference this issue on Oct 14, 2022
  10. jamoflaw commented on Oct 14, 2022

    @jamoflaw

    @joejulian - I believe #11440 should fix this bug - looks like an bug where null keys are preemptively removed before subcharts are processed which causes the subcharts to merge their keys back into the parent chart again.

  11. igorzamyslov commented on Oct 14, 2022

    @igorzamyslov

    It seems to be a duplicate of #9027

  12. jamoflaw commented on Oct 14, 2022

    @jamoflaw

    It seems to be a duplicate of #9027

    Yeah I'd agree - looks like the behaviour I replicated in that PR, it should resolve that issue too

  13. joejulian commented on Oct 14, 2022

    @joejulian
    Contributor

    Closing this one. Let's continue to track this in #9027. Thanks!

  14. rodrigoechaide commented on Dec 13, 2023

    @rodrigoechaide

    I have created a new issue because this problem persists in the latest version of Kubernetes.

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

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions