-
Notifications
You must be signed in to change notification settings - Fork 1.6k
✨ (helm/v2alpha) Extract image and resources from kustomize #5151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ (helm/v2alpha) Extract image and resources from kustomize #5151
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BadisLaffet1 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 |
|
|
|
Welcome @BadisLaffet1! |
|
Hi @BadisLaffet1. 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 Once the patch is verified, the new status will be reflected by the 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. |
|
/retitle ✨ helm/v2: Extract image and resources from kustomize |
|
@BadisLaffet1: Re-titling can only be requested by trusted users, like repository collaborators. In response to this:
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. |
|
Hi @BadisLaffet1, It looks great! 🎉 Before we get this one merged, please fix the lint issues — you can run make lint-fix locally to handle that. Also, it seems the commit message is failing for some reason — could you please take a look at that? Lastly, once the lint issues are fixed, please squash your commits so we end up with just one commit for merging. Moreover, please check the comments bellow. Looking forward to seeing your updates so we can get this one merged soon! 🚀 |
| It("should still include other basic sections", func() { | ||
| content := valuesTemplate.GetBody() | ||
|
|
||
| Expect(content).To(ContainSubstring("replicaCount:")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we keep it?
| content := valuesTemplate.GetBody() | ||
|
|
||
| Expect(content).NotTo(ContainSubstring("certManager:")) | ||
| Expect(content).NotTo(ContainSubstring("enable: true")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we keep it ?
| It("should have correct file permissions", func() { | ||
| info := valuesTemplate.GetIfExistsAction() | ||
| Expect(info).To(Equal(machinery.OverwriteFile)) | ||
| Expect(info).To(Equal(machinery.SkipFile)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we changing it ?
We should not change it.
| - name: MEMCACHED_IMAGE | ||
| value: memcached:1.6.26-alpine3.19 | ||
| {{- if .Values.controllerManager.image.digest }} | ||
| image: "{{ .Values.controllerManager.image.repository }}@{{ .Values.controllerManager.image.digest }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need digest?
|
If you don’t mind, I’d like to close this PR in favor of #5147 We recently introduced helm/v2alpha, which hasn’t been released yet. The changes in that PR address this issue (and a few others) and are required before the release. Since that work includes a significant refactor, merging this one separately would likely cause conflicts or break things. I really appreciate you taking the time to look into this and open the PR — thank you! 🙏 My sincere apologies for any inconvenience. I was already reviewing this area but forgot to assign the issue to myself. |
|
Thanks, @camilamacedo86 — totally understand! |
|
Hi @BadisLaffet1, Really sorry about this 🙏 I was initially thinking of keeping the image covered here as well since I didn’t want your effort to go to waste, but after reviewing it more closely, it looks like it would require some refactoring — and that would probably cause a lot of extra work later with rebases and conflict resolution. I truly appreciate all your effort on this! If you’d like to review or improve this further in a follow-up, that would be amazing — your help is always more than welcome. 💪 |
Ensures Helm v2-alpha extracts deployment configuration (image, imagePullPolicy, resources) from kustomize output instead of using hardcoded defaults.
Changes
Added
parseImageString()helper (parses image strings into repository/tag/digest components with registry port detection) / UpdatedExtractDeploymentConfig()(finds manager container by name, extracts image, imagePullPolicy, and resources from actual kustomize deployment).Updated
generateBasicValues()(populates values.yaml with extracted kustomize data instead of hardcoded defaults, implements digest-over-tag priority logic, conditional tag/digest inclusion based on actual deployment config).Implemented
templateImageReference()(creates conditional digest/tag templating with{{- if .Values.controllerManager.image.digest }}logic) / ImplementedtemplateResources()(generates dynamic resource templating with precise boundary detection using regex patterns), handles both- name: managerandname: managercontainer formats.Added test assertions validating image parsing, extraction logic, templating behavior, and generated output correctness with specific scenarios for tag/digest formats.
Before:
helm installdeployed hardcodedcontroller:latestwith static resource limits regardless of kustomize content .After:
helm installdeploys exact same image/resources asmake build-installer.Fixes #5113