Spamcheck subchart renders Deployment with spec.template.spec.nodeSelector twice causing failure to apply when using Flux
Summary
When setting .Values.gitlab.spamcheck.nodeSelector or .Values.global.nodeSelector the Spamcheck deployment is assigned spec.template.spec.nodeSelector twice which causes the rendered YAML to fail to apply when using Flux CD.
It fails with an error like this:
Helm upgrade failed for release gitlab/gitlabwith chart gitlab@9.8.2: error while running post render on files: map[string]interface {}(nil): yaml: unmarshal errors: line 132: mapping key nodeSelector" already defined at line 35
Rendering the chart with helm template my-gitlab gitlab/gitlab --version 9.8.2 --values values.yaml produces manifests that reveal that this field is set twice in the spec for the Spamcheck deployment.
Duplicate YAML keys like this are ignored with both client-side and server-side applies using kubectl so a non-GitOps tool applying the Helm chart would probably not encounter this error.
The deployment template does specify this field twice:
Steps to reproduce
- Set
.Values.gitlab.spamcheck.nodeSelectoror.Values.global.nodeSelector - Apply the Helm Chart as a
HelmReleasewith Flux - Observe the error
Configuration used
# values.yaml
gitlab:
spamcheck:
nodeSelector:
my-label: my-value
OR
# values.yaml
global:
nodeSelector:
my-label: my-value
Current behavior
Rendered deployment which is semantically invalid due to a duplicate YAML key.
Expected behavior
Rendered deployment which is semantically valid and only specifies the nodeSelector for this deployment once.
Versions
- Chart: 9.8.2
- Platform:
- Cloud: GKE
- Kubernetes: (
kubectl version)- Client: v1.29
- Server: 1.33
- Helm: (
helm version)- Client:
- Server:
- Flux CD:
- 2.7.5
Relevant logs
(Please provide any relevant log snippets you have collected, using code blocks (```) to format)