Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions internal/quota/controllers/policy/claim_creation.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ func (r *ClaimCreationPolicyReconciler) Reconcile(ctx context.Context, req mcrec
// Update policy status based on validation results
r.updatePolicyStatus(&policy, validationErrs)

// Update status if it has changed
// Always track the latest generation so the diff captures generation-only changes
policy.Status.ObservedGeneration = policy.Generation

// Only write to the API if something actually changed
if !equality.Semantic.DeepEqual(&policy.Status, originalStatus) {
policy.Status.ObservedGeneration = policy.Generation
if err := clusterClient.Status().Update(ctx, &policy); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to update ClaimCreationPolicy status: %w", err)
}
Expand Down
7 changes: 4 additions & 3 deletions internal/quota/controllers/policy/grant_creation.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ func (r *GrantCreationPolicyReconciler) Reconcile(ctx context.Context, req mcrec
// Update policy status based on validation results
r.updatePolicyStatus(&policy, validationErrs)

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

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