Skip to content

Commit f237376

Browse files
authored
[ws-manager-mk2] Extract headless task failure (WKS-18) (#17091)
* [ws-manager-mk2] Extract headless task failure * Undo ready status change, refactored #17114
1 parent 8f2f1e7 commit f237376

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

components/ws-manager-mk2/controllers/status.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,11 @@ func (r *WorkspaceReconciler) extractFailure(ctx context.Context, ws *workspacev
272272
}
273273
} else if terminationState.Reason == "Completed" && !isPodBeingDeleted(pod) {
274274
if ws.IsHeadless() {
275-
// headless workspaces are expected to finish
275+
// headless workspaces are expected to finish. But if they have a termination message,
276+
// there was a failure.
277+
if terminationState.Message != "" {
278+
return terminationState.Message, nil
279+
}
276280
return "", nil
277281
}
278282
return fmt.Sprintf("container %s completed; containers of a workspace pod are not supposed to do that", cs.Name), nil

components/ws-manager-mk2/controllers/workspace_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ func (r *WorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
126126
r.updateMetrics(ctx, &workspace)
127127
r.emitPhaseEvents(ctx, &workspace, oldStatus)
128128

129-
log.V(1).Info("updating workspace status", "status", workspace.Status)
129+
var podStatus *corev1.PodStatus
130+
if len(workspacePods.Items) > 0 {
131+
podStatus = &workspacePods.Items[0].Status
132+
}
133+
log.Info("updating workspace status", "status", workspace.Status, "podStatus", podStatus)
130134
err = r.Status().Update(ctx, &workspace)
131135
if err != nil {
132136
// log.WithValues("status", workspace).Error(err, "unable to update workspace status")

0 commit comments

Comments
 (0)