Skip to content

Commit

Permalink
fix: reduce log spam by patching status updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rquitales committed Sep 21, 2024
1 parent ab6c570 commit 832422e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion operator/internal/controller/auto/workspace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ func (r *WorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
w.Status.ObservedGeneration = w.Generation
ready.ObservedGeneration = w.Generation
meta.SetStatusCondition(&w.Status.Conditions, *ready)
return r.Status().Update(ctx, w)
// Use .Status().Patch() instead of .Update() to avoid conflicts with sequential reconcile loops hitting a
// stale version of the object from the cache.
return r.Status().Patch(ctx, w, client.MergeFrom(w), client.FieldOwner(FieldManager))
}

if w.DeletionTimestamp != nil {
Expand Down

0 comments on commit 832422e

Please sign in to comment.