From 225fbf1ef10068c68c08d689feda3c6fa9e6e7cd Mon Sep 17 00:00:00 2001 From: Angel Misevski Date: Thu, 30 Jun 2022 18:21:01 -0600 Subject: [PATCH] Avoid logging failure message repeatedly in PVC cleanup Since setting a workspace to the errored status will queue another reconcile, we only log the "failed to clean up common PVC" message if the workspace status is not already set to errored. Signed-off-by: Angel Misevski --- controllers/workspace/finalize.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/workspace/finalize.go b/controllers/workspace/finalize.go index bd9ae22f1..201c176f1 100644 --- a/controllers/workspace/finalize.go +++ b/controllers/workspace/finalize.go @@ -113,7 +113,10 @@ func (r *DevWorkspaceReconciler) finalizeStorage(ctx context.Context, log logr.L log.Info(storageErr.Message) return reconcile.Result{RequeueAfter: storageErr.RequeueAfter}, nil case *storage.ProvisioningError: - log.Error(storageErr, "Failed to clean up DevWorkspace storage") + if workspace.Status.Phase != dw.DevWorkspaceStatusError { + // Avoid repeatedly logging error unless it's relevant + log.Error(storageErr, "Failed to clean up DevWorkspace storage") + } finalizeStatus.phase = dw.DevWorkspaceStatusError finalizeStatus.setConditionTrue(dw.DevWorkspaceError, err.Error()) return reconcile.Result{}, nil