Skip to content

Commit 79c1830

Browse files
authored
Fix stale status blocking deployment reconciliation (#551)
## Summary - Move `ObservedGeneration` assignment before the `DeepEqual` status diff check in `GrantCreationPolicyReconciler` and `ClaimCreationPolicyReconciler` so that spec changes which produce the same validation result still trigger a status update. - Without this fix, `observedGeneration` never advances when conditions remain unchanged, causing Flux health checks to permanently report "InProgress". - The other quota reconcilers (`ResourceRegistration`, `ResourceGrant`, `AllowanceBucket`) already follow the correct pattern and required no changes. Fixes #550 ## Test plan - [x] Unit tests pass (`task test:unit`) - [ ] Deploy to test environment and verify `observedGeneration` advances after a no-op spec change on a `GrantCreationPolicy` or `ClaimCreationPolicy` - [ ] Confirm Flux health checks transition to "Ready" after the fix 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents bc341e7 + 0b32935 commit 79c1830

3 files changed

Lines changed: 402 additions & 5 deletions

File tree

internal/quota/controllers/policy/claim_creation.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ func (r *ClaimCreationPolicyReconciler) Reconcile(ctx context.Context, req mcrec
7878
// Update policy status based on validation results
7979
r.updatePolicyStatus(&policy, validationErrs)
8080

81-
// Update status if it has changed
81+
// Always track the latest generation so the diff captures generation-only changes
82+
policy.Status.ObservedGeneration = policy.Generation
83+
84+
// Only write to the API if something actually changed
8285
if !equality.Semantic.DeepEqual(&policy.Status, originalStatus) {
83-
policy.Status.ObservedGeneration = policy.Generation
8486
if err := clusterClient.Status().Update(ctx, &policy); err != nil {
8587
return ctrl.Result{}, fmt.Errorf("failed to update ClaimCreationPolicy status: %w", err)
8688
}

internal/quota/controllers/policy/grant_creation.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ func (r *GrantCreationPolicyReconciler) Reconcile(ctx context.Context, req mcrec
7676
// Update policy status based on validation results
7777
r.updatePolicyStatus(&policy, validationErrs)
7878

79-
// Update status if it has changed
80-
if !equality.Semantic.DeepEqual(&policy.Status, originalStatus) {
81-
policy.Status.ObservedGeneration = policy.Generation
79+
// Always track the latest generation so the diff captures generation-only changes
80+
policy.Status.ObservedGeneration = policy.Generation
8281

82+
// Only write to the API if something actually changed
83+
if !equality.Semantic.DeepEqual(&policy.Status, originalStatus) {
8384
if err := clusterClient.Status().Update(ctx, &policy); err != nil {
8485
return ctrl.Result{}, fmt.Errorf("failed to update GrantCreationPolicy status: %w", err)
8586
}

0 commit comments

Comments
 (0)