-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Description
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:
- Nested
null
values do not remove keys from sub-charts #12637 - Deleting a value is not supported in dependencies #12741
- Unable to pass null as Helm value argoproj/argo-cd#16312
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)