Skip to content

✨ (helm/v2-alpha): add extra volumes support#5496

Open
camilamacedo86 wants to merge 1 commit intokubernetes-sigs:masterfrom
camilamacedo86:extra-volumns
Open

✨ (helm/v2-alpha): add extra volumes support#5496
camilamacedo86 wants to merge 1 commit intokubernetes-sigs:masterfrom
camilamacedo86:extra-volumns

Conversation

@camilamacedo86
Copy link
Member

@camilamacedo86 camilamacedo86 commented Feb 21, 2026

Support manager.extraVolumes and manager.extraVolumeMounts: extract from kustomize (excluding webhook-certs/metrics-certs), inject into values when present, and template in manager deployment (including when volumes: []). Document in Helm v2-alpha plugin page.

Closes: #5485

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 21, 2026
@camilamacedo86 camilamacedo86 changed the title ✨ (helm/v2-alpha): add extra volumes support and document in book ✨ (helm/v2-alpha): add extra volumes support Feb 21, 2026

The chart supports extra volumes and volume mounts for the manager (e.g. secrets, config files) in addition to the built-in webhook and metrics cert volumes.

- **From kustomize**: If your deployment in `dist/install.yaml` includes volumes other than the default `webhook-certs` and `metrics-certs` (from the scaffolded patches), the plugin adds them to `values.yaml` as `manager.extraVolumes` and `manager.extraVolumeMounts`. The manager template merges them into the deployment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify this point, if they are defined in the kustomize output, other than metrics-certs and web hook-certs, the values are extracted and added to the values?

I would have expected them to be added into the chart template and not the values. As any further additions would require the plugin to be run with --force.

Copy link
Member Author

@camilamacedo86 camilamacedo86 Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify this point, if they are defined in the kustomize output, other than metrics-certs and web hook-certs, the values are extracted and added to the values?

Yes.

I would have expected them to be added into the chart template and not the values. As any further additions would require the plugin to be run with --force.

Yes, that is how it is. To update the values you need to run the force.
We cannot update the values without force otherwise it would lost the customizations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you missed my point or I didn't articulate myself very well.

I think if the volumes are defined in kustomize, they should be added directly to the template and NOT to the values.yaml

The values.yaml should only be for additional volumes IMO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if the volumes are defined in kustomize,

All should be defined in the kustomize.
They are the source of truth.
The Helm Chart is just a way to package the solution in this format.
It should not deviate from the project config, and we should not add anything in the Helm charts. It only package the project for this format.

Copy link
Contributor

@asergeant01 asergeant01 Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My example:

# config/manager/manager.yaml (or a kustomize patch)
spec:
  template:
    spec:
      volumes:
        - name: app-secret-1
          secret:
            secretName: app-secret-1
# dist/chart/values.yaml
manager:
  extraVolumes:
    - name: app-secret-1
      secret:
        secretName: app-secret-1
# dist/chart/templates/deployment.yaml (snippet)
spec:
  template:
    spec:
      volumes:
        {{- if .Values.manager.extraVolumes }}
        {{- toYaml .Values.manager.extraVolumes | nindent 8 }}
        {{- end }}

Lets say the maintainer makes modifications to the values.yaml file but also adds another volume to the config....

# config/manager/manager.yaml (or a kustomize patch)
spec:
  template:
    spec:
      volumes:
        - name: app-secret-1
          secret:
            secretName: app-secret-1
        - name: app-secret-2
          secret:
            secretName: app-secret-2

The only way to have that new volume in the chart is either add it manually to the values.yaml or re-run kubebuilder edit --plugins=helm/v2-alpha --force which would overwrite any manual changes.

What I am saying is, I believe the generated template should be:

# dist/chart/templates/deployment.yaml (snippet)
spec:
  template:
    spec:
      volumes:
        - name: app-secret-1
          secret:
            secretName: app-secret-1
        - name: app-secret-2
          secret:
            secretName: app-secret-2
        {{- if .Values.manager.extraVolumes }}
        {{- toYaml .Values.manager.extraVolumes | nindent 8 }}
        {{- end }}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @asergeant01

Let me know if the changes in place address your request.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@camilamacedo86 I didn't test it, but it certainly looks like it addresses the request. Thank you

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 25, 2026
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 26, 2026
Support manager.extraVolumes and manager.extraVolumeMounts: extract from
kustomize (excluding webhook-certs/metrics-certs), inject into values when
present, and template in manager deployment (including when volumes: []).
Document in Helm v2-alpha plugin page.

Generated-by: Cursor/Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helm/v2-alpha: No support for configurable volumes/volumeMounts in generated charts

3 participants