-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Include generic Services in Helm v2-alpha chart generation #5256
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
base: master
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: UJESH2K 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 @UJESH2K! |
|
Hi @UJESH2K. 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. |
97ad0e7 to
cbc54fd
Compare
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.
Pull request overview
This PR addresses issue #5248 by adding support for generic Service resources in the Helm v2-alpha chart generation. Previously, only Services with "webhook" or "metrics" in their names were included in the generated Helm chart, causing other Service definitions to be silently dropped despite being present in the kustomize install.yaml.
Key Changes
- Added
isGenericService()method to identify Services that are neither webhook nor metrics related - Added
collectGenericServices()method to gather these services into a separate group - Integrated generic services into
OrganizeByFunction()under a new "services" category
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // collectGenericServices gathers all other service resources | ||
| func (o *ResourceOrganizer) collectGenericServices() []*unstructured.Unstructured { | ||
| var generic []*unstructured.Unstructured | ||
|
|
||
| for _, service := range o.resources.Services { | ||
| if o.isGenericService(service) { | ||
| generic = append(generic, service) | ||
| } | ||
| } | ||
| return generic | ||
| } |
Copilot
AI
Dec 7, 2025
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.
The new generic services functionality lacks test coverage. While the existing tests verify metrics services (lines 98-124 in chart_converter_test.go), there are no tests verifying that generic services (services without "webhook" or "metrics" in their names) are properly collected, organized into the "services" group, and written to the helm chart.
Consider adding a test case similar to the existing metrics service test that:
- Creates a service without "webhook" or "metrics" in its name
- Verifies it's written to
dist/chart/templates/servicesdirectory - Ensures the service is not placed in the webhook or metrics groups
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.
I’ve added a new unit test (generic_services_test.go) that covers the generic Service behavior mentioned here.
The test verifies that a Service without "webhook" or "metrics" in its name is:
-
detected as a generic Service
-
included in the "services" group
-
not placed under "webhook" or "metrics"
This provides test coverage for the new logic introduced in this PR.
Let me know if additional integration-level chart output tests are needed.
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.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,34 @@ | |||
| package kustomize_test | |||
Copilot
AI
Dec 7, 2025
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.
The test file is missing the Apache 2.0 copyright header that is present in all other test files in this directory. All test files in this package (suite_test.go, parser_test.go, chart_converter_test.go, helm_templater_test.go) include the standard copyright notice.
| @@ -0,0 +1,34 @@ | |||
| package kustomize_test | |||
Copilot
AI
Dec 7, 2025
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.
The package declaration uses package kustomize_test which is inconsistent with other test files in this directory. All other test files (chart_converter_test.go, helm_templater_test.go, suite_test.go) use package kustomize. While both approaches are valid in Go, consistency within a package is important for maintainability.
| package kustomize_test | |
| package kustomize |
Fixes #5248
The Helm v2-alpha plugin currently only includes Service resources whose
names contain the substrings "webhook" or "metrics". All other Service
objects found under config/services/ are silently dropped during chart
generation. This results in missing Service definitions in the final Helm
chart, even though these Services are included in the install.yaml produced
by kustomize.
Root Cause
Within resource_organizer.go, Services are only classified under:
Any Service that does not match these filters is never added to any group,
and therefore excluded from the final Helm chart output.
Summary of Changes
This PR introduces support for "generic" Services—Service resources that are
neither webhook nor metrics related—by grouping them under a new
servicescategory. This ensures all user-defined Services are included in the Helm
chart.
A new function was added:
A new collector was added:
And the main organizer now includes these Services:
✅ Tests Added
This PR also includes a new unit test (generic_services_test.go) that verifies:
The test follows the existing Ginkgo/Gomega test structure used by the project.