From 832422e035ff68737145ecfe72cbe6c55b2d5381 Mon Sep 17 00:00:00 2001 From: Ramon Quitales Date: Sat, 21 Sep 2024 10:47:07 -0700 Subject: [PATCH] fix: reduce log spam by patching status updates --- operator/internal/controller/auto/workspace_controller.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/operator/internal/controller/auto/workspace_controller.go b/operator/internal/controller/auto/workspace_controller.go index 8bcb4b3e..2246a251 100644 --- a/operator/internal/controller/auto/workspace_controller.go +++ b/operator/internal/controller/auto/workspace_controller.go @@ -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 {