Description
When the kustomize input contains app.kubernetes.io/name in selector/matchLabels fields, helmify emits both the hardcoded original value and the chart.selectorLabels include, which also contains app.kubernetes.io/name. This produces duplicate YAML mapping keys that are rejected by strict YAML parsers (e.g. ArgoCD).
Version
helmify v0.4.19
Steps to reproduce
- Have a standard Kubebuilder project with
app.kubernetes.io/name in config/manager/manager.yaml and config/default/metrics_service.yaml (default Kubebuilder scaffolding)
- Run
kustomize build config/default | helmify
Kustomize input (relevant section)
The Deployment in the kustomize output contains:
spec:
selector:
matchLabels:
app.kubernetes.io/name: platform-operator
control-plane: controller-manager
template:
metadata:
labels:
app.kubernetes.io/name: platform-operator
control-plane: controller-manager
The Service selector contains:
spec:
selector:
app.kubernetes.io/name: platform-operator
control-plane: controller-manager
Actual output
deployment.yaml:
spec:
selector:
matchLabels:
app.kubernetes.io/name: platform-operator # hardcoded from kustomize
control-plane: controller-manager
{{- include "chart.selectorLabels" . | nindent 6 }} # also emits app.kubernetes.io/name
metrics-service.yaml:
spec:
selector:
app.kubernetes.io/name: platform-operator # hardcoded from kustomize
control-plane: controller-manager
{{- include "chart.selectorLabels" . | nindent 4 }} # also emits app.kubernetes.io/name
Where chart.selectorLabels is defined as:
{{- define "chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
Expected output
The hardcoded app.kubernetes.io/name should be omitted from selectors when chart.selectorLabels is already included, since that helper already provides the same key:
spec:
selector:
matchLabels:
control-plane: controller-manager
{{- include "chart.selectorLabels" . | nindent 6 }}
Impact
ArgoCD (and other strict YAML parsers) reject the rendered manifests:
error decoding resources yaml: unmarshal errors:
line 1952: mapping key "app.kubernetes.io/name" already defined at line 1950
Description
When the kustomize input contains
app.kubernetes.io/namein selector/matchLabels fields, helmify emits both the hardcoded original value and thechart.selectorLabelsinclude, which also containsapp.kubernetes.io/name. This produces duplicate YAML mapping keys that are rejected by strict YAML parsers (e.g. ArgoCD).Version
helmify v0.4.19
Steps to reproduce
app.kubernetes.io/nameinconfig/manager/manager.yamlandconfig/default/metrics_service.yaml(default Kubebuilder scaffolding)kustomize build config/default | helmifyKustomize input (relevant section)
The Deployment in the kustomize output contains:
The Service selector contains:
Actual output
deployment.yaml:
metrics-service.yaml:
Where
chart.selectorLabelsis defined as:Expected output
The hardcoded
app.kubernetes.io/nameshould be omitted from selectors whenchart.selectorLabelsis already included, since that helper already provides the same key:Impact
ArgoCD (and other strict YAML parsers) reject the rendered manifests: