Skip to content

Commit

Permalink
Avoid logging failure message repeatedly in PVC cleanup
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
amisevsk committed Jul 4, 2022
1 parent e3805fb commit 225fbf1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controllers/workspace/finalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 225fbf1

Please sign in to comment.