Skip to content

Conversation

@zarcen
Copy link

@zarcen zarcen commented Nov 20, 2025

The change is to bridge the gap of helm/v2alpha when using images in the private registry.
If users have private image and set imagePullSecrets in the original kustomize, it is not parsed and templated accordingly to helm.

This update allows manager Helm chart to take imagePullSecrets into account and generate the template for it.

Tests:

  • I have read and followed CONTRIBUTING.md
  1. Unit tests
go test ./pkg/plugins/optional/helm/v2alpha/scaffolds/internal/kustomize
ok  	sigs.k8s.io/kubebuilder/v4/pkg/plugins/optional/helm/v2alpha/scaffolds/internal/kustomize	0.256s
go test ./pkg/plugins/optional/helm/v2alpha/scaffolds/internal/templates
ok  	sigs.k8s.io/kubebuilder/v4/pkg/plugins/optional/helm/v2alpha/scaffolds/internal/templates	0.218s
  1. Testdata
    Rather than changing the test/testdata/generate.sh, just keep it as most users may not need imagePullSecrets.
    For users who add imagePullSecrets in their kustomization under config/manager/manager.yaml, this will work nicely.
  spec:
    template:
      spec:
+       imagePullSecrets:
+         - name: ghcr-creds
        containers:
        - command:
          - /manager

This is validated with make generate-charts by applying a local change of testdata/project-v4-with-plugins/config/manager/manager.yaml

The resulting helm template of manager-deployment looks like:

+           {{- if .Values.manager.imagePullSecrets }}
+           imagePullSecrets:
+             {{- toYaml .Values.manager.imagePullSecrets | nindent 14 }}
+           {{- end }}
            securityContext:
              {{- if .Values.manager.podSecurityContext }}
              {{- toYaml .Values.manager.podSecurityContext | nindent 14 }}
              {{- else }}
              {}
              {{- end }}

Closes #5241

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 20, 2025
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 20, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: zarcen / name: Wei-Chen Chen (6f37228)

@zarcen zarcen marked this pull request as draft November 20, 2025 21:59
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zarcen
Once this PR has been reviewed and has the lgtm label, please assign varshaprasad96 for approval. For more information see the Code Review Process.

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

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
Copy link
Contributor

Welcome @zarcen!

It looks like this is your first PR to kubernetes-sigs/kubebuilder 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubebuilder has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 20, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @zarcen. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Nov 20, 2025
@zarcen zarcen changed the title [WIP] Missing img pull secrets helm [WIP] Add imagePullSecrets parsing in helm v2-alpha plugin Nov 20, 2025
@zarcen zarcen force-pushed the missing-img-pull-secrets-helm branch from 6fdd5f2 to 1641876 Compare November 20, 2025 22:08
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 20, 2025
@zarcen zarcen force-pushed the missing-img-pull-secrets-helm branch from ed0114a to 6f37228 Compare November 21, 2025 03:55
@zarcen zarcen marked this pull request as ready for review November 21, 2025 04:08
@zarcen zarcen changed the title [WIP] Add imagePullSecrets parsing in helm v2-alpha plugin 🐛 (helm/v2alpha): Add imagePullSecrets parsing in helm v2-alpha plugin Nov 21, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 21, 2025
@zarcen zarcen changed the title 🐛 (helm/v2alpha): Add imagePullSecrets parsing in helm v2-alpha plugin 🐛 (helm/v2alpha):imagePullSecrets parsing in helm v2-alpha plugin Nov 21, 2025
@zarcen zarcen changed the title 🐛 (helm/v2alpha):imagePullSecrets parsing in helm v2-alpha plugin 🐛 (helm/v2alpha): imagePullSecrets parsing in helm v2-alpha plugin Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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 plugin v2-alpha doesn't template imagePullSecrets

2 participants