Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot remove objects in dependent charts by setting values to null #12991

Open
zsolt-marta-bitrise opened this issue Apr 29, 2024 · 1 comment
Labels
bug Categorizes issue or PR as related to a bug.

Comments

@zsolt-marta-bitrise
Copy link

We're seeing that we cannot remove objects in dependent charts by setting the values to null , they will still get included in the result.

This used to work before, and this is causing apps deployed using ArgoCD to fail on probes getting introduced incorrectly (as they are defined in the dependent charts and cannot be nulled out).
This works well in ArgoCD 2.9.1, bot not in 2.9.2 which upgraded helm from 3.12.1 to 3.13.2, so the issue got introduced between those versions. I suspect this has to do something with this PR. The default template ProcessDependencies() got replaced with ProcessDependenciesWithMerge(), which ultimately does not remove null keys.

Related issues:

Issue

After running helm template . -f values.yaml in helm-issue (see setup below) and values.yaml:

helm-dep:
  port: null
  • Got:
...
 spec:
      containers:
        - image: nginx:alpine
          name: nginx
          resources: {}
          ports:
            - containerPort: 80
              protocol: TCP
              name: http
  • Want:
...
 spec:
      containers:
        - image: nginx:alpine
          name: nginx
          resources: {}

Please ignore that this is not functional this way, this is just to demonstrate the issue. In our real use case, this is causing probes getting incorrectly introduced, failing deployments in newer ArgoCD versions.


Note: we get the correct result if we do

helm-dep:
  port: ""

Minimal setup:

  • helm-issue/Chart.yaml:
---
apiVersion: v2
appVersion: "0.1.27"
description: A Helm chart that demonstrates nulling issue
name: helm-issue
version: "0.1.0"
dependencies:
  - name: helm-dep
    version: "0.1.0"
    repository: "file://../helm-dep"
  • helm-issue/values.yaml:
helm-dep:
  port: null
  • helm-dep/templates/deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: helmtest
  name: {{ .Release.Name }}
  namespace: {{ .Release.Namespace }}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: helmtest
  template:
    metadata:
      labels:
        app: helmtest
    spec:
      containers:
        - image: nginx:alpine
          name: nginx
          resources: {}
          {{- with .Values.port }}
          ports:
              - containerPort: {{ .containerPort }}
                protocol: TCP
                name: {{ .name }}
          {{- end }}
  • helm-dep/Chart.yaml:
---
apiVersion: v2
appVersion: "0.1.27"
description: A Helm subchart that demonstrates nulling issue
name: helm-dep
version: "0.1.0"
  • helm-dep/values.yaml:
port:
  containerPort: 80
  name: http

(Of course, helm dependency update has to be run)

@kastl-ars
Copy link

I have the same issue with Helm v3.14.4, while it was working some time ago. Will try to get my hands on older releases and check if those are working...

@gjenkins8 gjenkins8 added the bug Categorizes issue or PR as related to a bug. label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants