Skip to content

Deployment creates orphaned ConfigMap volume when .Values.volumes is set without .Values.configMaps #236

Closed

Description

@Grobakumma

Describe the bug

Describe the Bug

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-dir
    configMap:
      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

  1. Supply a custom values.yaml with custom volumes, but without `configMaps:``
volumes:
  - name: my-custom-volume
    emptyDir: {}
  1. Render the templates:
helm template my-release unleash/unleash -f values.yaml
  1. 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-dir
    configMap:
      name: {{ include "unleash.fullname" . }}
  {{- end }}
  {{- if .Values.volumes }}
  {{- toYaml .Values.volumes | nindent 8 }}
  {{- end }}
{{- end }}

Unleash version

5.6.7

Subscription type

Enterprise

Hosting type

Self-hosted

SDK information (language and version)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions