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 (f6d1a11)

@zarcen zarcen marked this pull request as draft November 20, 2025 21:59
@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
@vitorfloriano
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 3, 2025
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 9, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, zarcen

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

The pull request process is described 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 k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Dec 9, 2025
@camilamacedo86
Copy link
Member

@zarcen

Can you please solve the conflict for we get this one merge?

@camilamacedo86 camilamacedo86 removed lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 9, 2025
@zarcen zarcen force-pushed the missing-img-pull-secrets-helm branch from 6f37228 to a7244f3 Compare December 9, 2025 18:44
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Dec 9, 2025
@zarcen
Copy link
Author

zarcen commented Dec 9, 2025

@zarcen

Can you please solve the conflict for we get this one merge?

Thanks for the review. I have rabased it and kept only one commit.

@zarcen zarcen force-pushed the missing-img-pull-secrets-helm branch from a7244f3 to f6d1a11 Compare December 10, 2025 04:04
@zarcen
Copy link
Author

zarcen commented Dec 10, 2025

I noticed some new version of go linter is enforced. I rebase again to make sure all linters are compliant:

make lint
0 issues.

@k8s-ci-robot
Copy link
Contributor

@zarcen: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubebuilder-e2e-k8s-1-33-0 f6d1a11 link true /test pull-kubebuilder-e2e-k8s-1-33-0

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

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. ok-to-test Indicates a non-member PR verified by an org member that 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

4 participants