-
-
Notifications
You must be signed in to change notification settings - Fork 115
Flux Autodiscovery Doesn't discover some HelmRelease #6200 #7641
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: main
Are you sure you want to change the base?
Conversation
df7c946 to
30e9565
Compare
30e9565 to
a93a823
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 fixes Flux autodiscovery to properly handle multi-document YAML files containing multiple HelmRelease resources. Previously, only the first HelmRelease in a multi-document file would be discovered, causing subsequent resources to be ignored.
Changes:
- Refactored HelmRelease manifest discovery to process each document in multi-document YAML files separately
- Added tracking flags to prevent duplicate file paths when multiple resources exist in one file
- Added comprehensive test coverage for multi-document YAML files
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/plugins/autodiscovery/flux/helmreleaseManifests.go | Refactored to read files once, split by YAML document separator, and process each HelmRelease document individually |
| pkg/plugins/autodiscovery/flux/helmrelease.go | Removed unused loadHelmRelease() function that only handled single documents |
| pkg/plugins/autodiscovery/flux/utils.go | Added tracking flags to prevent adding the same file path multiple times when multiple HelmRelease or OCIRepository documents exist in one file |
| pkg/plugins/autodiscovery/flux/testdata/helmrelease/multi-release/multi-helmrelease.yaml | Test data with three documents: two HelmRelease resources and one HelmRepository |
| pkg/plugins/autodiscovery/flux/main_test.go | Added test case validating that two separate manifests are generated for the multi-document file |
| pkg/plugins/autodiscovery/flux/utils_test.go | Updated to include the new multi-release test file in expected results |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: 'deps(flux): bump Helmrelease "udash"' | ||
| kind: 'yaml' | ||
| spec: | ||
| file: 'multi-helmrelease.yaml' |
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 target is missing the parameter documentindex to define where document Updatecli should update
Fix #6200
This PR fixes Flux autodiscovery to properly handle multi-document YAML files containing multiple HelmRelease resources. Previously,
discoverHelmreleaseManifests()would only process the first document in a multi-document YAML file, causing subsequent HelmRelease resources to be ignored.Changes
Refactored
discoverHelmreleaseManifests()(pkg/plugins/autodiscovery/flux/helmreleaseManifests.go):bytes.Split()loadHelmReleaseFromBytes()Fixed duplicate file path issue in
searchFluxFiles()(pkg/plugins/autodiscovery/flux/utils.go):Added comprehensive test case (
pkg/plugins/autodiscovery/flux/testdata/helmrelease/multi-release/):TestSearchFluxFilesto include the new test fileTest
To test this pull request, you can run the following commands:
Or to run the specific multi-document test case:
Additional Information
Checklist
Tradeoff
Potential improvement
searchFluxFiles()anddiscoverHelmreleaseManifests()now use the same pattern