You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deployment creates orphaned ConfigMap volume when .Values.volumes is set without .Values.configMaps #236
In deployment.yaml, the volumes section uses an OR condition to determine whether the volumes: block should be rendered:
{{- if or .Values.configMaps .Values.volumes }}volumes:
- name: config-dirconfigMap:
name: {{ include "unleash.fullname" . }}{{- if .Values.volumes }}{{- toYaml .Values.volumes | nindent 8 }}{{- end }}{{- end }}
If a user defines custom .Values.volumes (e.g., mounting a PVC, secret, or hostPath) but leaves .Values.configMaps unset:
The or condition evaluates to true.
The configmap.yaml template does not render a ConfigMap (since .Values.configMaps is empty).
The deployment.yaml still unconditionally adds - name: config-dir pointing to the release-named ConfigMap to the volumes list.
This creates an orphaned volume entry referencing a non-existent ConfigMap inside the Deployment spec, causing validation warnings in GitOps/linting tools.
Steps to reproduce the bug
Supply a custom values.yaml with custom volumes, but without `configMaps:``
Check the rendered Deployment manifest under spec.template.spec.volumes.
Expected behavior
The - name: config-dir volume should only be appended to volumes: if .Values.configMaps is actually defined and non-empty.
Logs, error output, etc.
Screenshots
No response
Additional context
Actual Behavior
Setting .Values.volumes triggers the rendering of - name: config-dir regardless of whether .Values.configMaps exists, creating a broken reference to a non-existent ConfigMap.
Proposed Solution
Wrap the config-dir volume item inside an explicit {{- if .Values.configMaps }} check:
{{- if or .Values.configMaps .Values.volumes }}volumes:
{{- if .Values.configMaps }}
- name: config-dirconfigMap:
name: {{ include "unleash.fullname" . }}{{- end }}{{- if .Values.volumes }}{{- toYaml .Values.volumes | nindent 8 }}{{- end }}{{- end }}
Activity