Skip to content

Commit d622f9d

Browse files
committed
Track UID of existing bundle deployment to prevent orphaning on failure
1 parent 4402cb2 commit d622f9d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/cmd/controller/reconciler/bundle_controller.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,14 @@ func (r *BundleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
358358

359359
helmvalues.ClearOptions(bd)
360360

361+
// If there's already a bundledeployment for this target, track its UID
362+
// before calling createBundleDeployment, which might fail. This prevents
363+
// cleanupOrphanedBundleDeployments from incorrectly removing this bundledeployment
364+
// as "orphaned". See https://github.com/rancher/fleet/issues/4144
365+
if target.Deployment != nil && target.Deployment.UID != "" {
366+
bundleDeploymentUIDs.Insert(target.Deployment.UID)
367+
}
368+
361369
bd, err = r.createBundleDeployment(
362370
ctx,
363371
logger,

0 commit comments

Comments
 (0)