Skip to content

Commit bd3fcca

Browse files
committed
Update workspace status message to include stopped and deleted
Update status message to show "Stopping"/"Stopped" when a workspace is stopped, and "Cleaning up resources for deletion" when we're waiting on a finalizer to be cleared. Signed-off-by: Angel Misevski <[email protected]>
1 parent 86bed19 commit bd3fcca

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

controllers/workspace/finalize.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ func (r *DevWorkspaceReconciler) finalize(ctx context.Context, log logr.Logger,
6363
if !hasFinalizer(workspace) {
6464
return reconcile.Result{}, nil
6565
}
66+
workspace.Status.Message = "Cleaning up resources for deletion"
67+
err := r.Client.Status().Update(ctx, workspace)
68+
if err != nil && !k8sErrors.IsConflict(err) {
69+
return reconcile.Result{}, err
70+
}
71+
6672
// Need to make sure Deployment is cleaned up before starting job to avoid mounting issues for RWO PVCs
6773
wait, err := provision.DeleteWorkspaceDeployment(ctx, workspace, r.Client)
6874
if err != nil {

controllers/workspace/status.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,13 @@ func getInfoMessage(workspace *devworkspace.DevWorkspace, conditions map[devwork
151151
if msg, ok := conditions[devworkspace.WorkspaceFailedStart]; ok {
152152
return msg
153153
}
154-
// Use ideUrl when workspace is running
155-
if workspace.Status.Phase == devworkspace.WorkspaceStatusRunning {
154+
switch workspace.Status.Phase {
155+
case devworkspace.WorkspaceStatusRunning:
156156
return workspace.Status.IdeUrl
157+
case devworkspace.WorkspaceStatusStopped, devworkspace.WorkspaceStatusStopping:
158+
return string(workspace.Status.Phase)
157159
}
160+
158161
// Check for progress
159162
if _, ok := conditions[devworkspace.WorkspaceReady]; ok {
160163
return "Waiting on editor to start"

0 commit comments

Comments
 (0)