Skip to content

Commit ea49717

Browse files
committed
Set status on DevWorkspace when PVC cleanup fails to make it clearer
Signed-off-by: Angel Misevski <[email protected]>
1 parent 14a31bc commit ea49717

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

controllers/workspace/finalize.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,15 @@ func (r *DevWorkspaceReconciler) finalize(ctx context.Context, log logr.Logger,
100100
clearFinalizer(workspace)
101101
return reconcile.Result{}, r.Update(ctx, workspace)
102102
case batchv1.JobFailed:
103-
log.Error(fmt.Errorf("PVC clean up job failed: message %q", condition.Message),
103+
log.Error(fmt.Errorf("PVC clean up job failed: message: %q", condition.Message),
104104
"Failed to clean PVC on workspace deletion")
105-
return reconcile.Result{}, nil
105+
failedStatus := &currentStatus{
106+
Conditions: map[v1alpha2.WorkspaceConditionType]string{
107+
"Error": fmt.Sprintf("Failed to clean PVC on deletion. See logs for job %q for details", clusterJob.Name),
108+
},
109+
Phase: "Error",
110+
}
111+
return r.updateWorkspaceStatus(workspace, r.Log, failedStatus, reconcile.Result{}, nil)
106112
}
107113
}
108114
return reconcile.Result{}, nil

0 commit comments

Comments
 (0)