GC incorrectly uninstalls helm releases when BundleDeployment name exceeds 53 chars#5365
Closed
0xavi0 wants to merge 1 commit into
Closed
GC incorrectly uninstalls helm releases when BundleDeployment name exceeds 53 chars#53650xavi0 wants to merge 1 commit into
0xavi0 wants to merge 1 commit into
Conversation
…ceeds 53 chars - `releaseKey()` in the garbage collector now applies `names.HelmReleaseName()` when no explicit `helm.releaseName` is set, mirroring what `helmdeployer.getOpts()` does at install time - Without this, names >53 chars produced different strings in the two paths (raw vs truncated+hashed), causing the GC to treat a valid release as orphaned and uninstall it on every reconcile loop Refers to: rancher#5261 Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
0xavi0
force-pushed
the
5261-no-gc-for-long-names
branch
from
June 29, 2026 10:00
4253d39 to
af29b97
Compare
0xavi0
marked this pull request as ready for review
June 29, 2026 10:48
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the agent garbage collector’s Helm release-key computation so it matches the Helm install path when helm.releaseName is not explicitly set, preventing valid releases from being treated as orphaned when BundleDeployment names exceed Helm’s 53-character limit (issue #5261).
Changes:
- Update
releaseKey()to applynames.HelmReleaseName(bd.Name)whenhelm.releaseNameis unset. - Extend
TestCleanupReleasesto cover long BundleDeployment names without explicithelm.releaseName. - Add a dedicated
TestReleaseKeysuite to lock in namespace and release-name derivation behavior (including long-name truncation/hashing).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/cmd/agent/deployer/cleanup/cleanup.go | Aligns GC release-key derivation with Helm install-time naming logic via names.HelmReleaseName. |
| internal/cmd/agent/deployer/cleanup/cleanup_test.go | Adds regression coverage for long BundleDeployment names and explicit helm.releaseName, plus a release-key unit test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+233
to
+240
| func splitNSAndName(s string) (ns, name string, ok bool) { | ||
| for i := range len(s) { | ||
| if s[i] == '/' { | ||
| return s[:i], s[i+1:], true | ||
| } | ||
| } | ||
| return "", "", false | ||
| } |
Comment on lines
+226
to
+228
| if len(release) > 53 { | ||
| t.Errorf("release name %q is %d chars, exceeds Helm's 53-char limit", release, len(release)) | ||
| } |
Contributor
Author
|
closing this as there was already a PR open to fix the same :/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
releaseKey()in the garbage collector now appliesnames.HelmReleaseName()when no explicithelm.releaseNameis set, mirroring whathelmdeployer.getOpts()does at install timeRefers to: #5261
Additional Information
Checklist
- [ ] I have updated the documentation via a pull request in the fleet-product-docs repository.