π Description
pkg/hub/controllers/cluster/reconciler.go declares var retryAttempts = 0 at the package level (line 88). The handleClusterDeletion function increments it to enforce MAX_CLUSTER_DEREGISTRATION_ATTEMPTS = 3. Because it is a package-level var:
- If multiple Cluster objects are being deleted simultaneously, their attempt counts are merged.
- After 3 failures on any single cluster, all subsequent clusters also stop retrying immediately.
- Restarting the operator pod resets the counter, breaking the intended "stop after 3 attempts" semantics.
π Reproduction steps
- Create two Cluster CRs.
- Make
createDeregisterJob fail (mock or break the job).
- Delete both clusters simultaneously.
- Observe that the first cluster's failures exhaust retryAttempts for the second.
π Expected behavior
Each Cluster object should track its own deregistration attempt count β store it in the Cluster CR's status or annotations.
π Actual Behavior
Shared global counter causes incorrect retry limiting across unrelated cluster objects.
π Relevant log output
Version
No response
π₯οΈ What operating system are you seeing the problem on?
No response
β
Proposed Solution
Move attempt tracking into the Cluster CR's status field or use an annotation. Alternatively, use r.Status().Update to persist a retry count per object.
π Have you spent some time to check if this issue has been raised before?
Code of Conduct
π Description
pkg/hub/controllers/cluster/reconciler.godeclaresvar retryAttempts = 0at the package level (line 88). ThehandleClusterDeletionfunction increments it to enforceMAX_CLUSTER_DEREGISTRATION_ATTEMPTS = 3. Because it is a package-level var:π Reproduction steps
createDeregisterJobfail (mock or break the job).π Expected behavior
Each Cluster object should track its own deregistration attempt count β store it in the Cluster CR's status or annotations.
π Actual Behavior
Shared global counter causes incorrect retry limiting across unrelated cluster objects.
π Relevant log output
Version
No response
π₯οΈ What operating system are you seeing the problem on?
No response
β Proposed Solution
Move attempt tracking into the Cluster CR's status field or use an annotation. Alternatively, use
r.Status().Updateto persist a retry count per object.π Have you spent some time to check if this issue has been raised before?
Code of Conduct