Skip to content

GC incorrectly uninstalls helm releases when BundleDeployment name exceeds 53 chars#5365

Closed
0xavi0 wants to merge 1 commit into
rancher:mainfrom
0xavi0:5261-no-gc-for-long-names
Closed

GC incorrectly uninstalls helm releases when BundleDeployment name exceeds 53 chars#5365
0xavi0 wants to merge 1 commit into
rancher:mainfrom
0xavi0:5261-no-gc-for-long-names

Conversation

@0xavi0

@0xavi0 0xavi0 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor
  • 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: #5261

Additional Information

Checklist

- [ ] I have updated the documentation via a pull request in the fleet-product-docs repository.

@0xavi0 0xavi0 added this to the v2.16.0 milestone Jun 29, 2026
@0xavi0 0xavi0 self-assigned this Jun 29, 2026
@0xavi0 0xavi0 added this to Fleet Jun 29, 2026
…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
0xavi0 force-pushed the 5261-no-gc-for-long-names branch from 4253d39 to af29b97 Compare June 29, 2026 10:00
@0xavi0
0xavi0 marked this pull request as ready for review June 29, 2026 10:48
@0xavi0
0xavi0 requested a review from a team as a code owner June 29, 2026 10:48
Copilot AI review requested due to automatic review settings June 29, 2026 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 apply names.HelmReleaseName(bd.Name) when helm.releaseName is unset.
  • Extend TestCleanupReleases to cover long BundleDeployment names without explicit helm.releaseName.
  • Add a dedicated TestReleaseKey suite 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))
}
@0xavi0

0xavi0 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

closing this as there was already a PR open to fix the same :/

@0xavi0 0xavi0 closed this Jun 29, 2026
@github-project-automation github-project-automation Bot moved this to ✅ Done in Fleet Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants