Skip to content

Commit e520320

Browse files
committed
[ws-manager] Properly stop all headless workspaces
not just prebuilds
1 parent 36cca67 commit e520320

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

components/ws-manager/pkg/manager/status.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -576,12 +576,6 @@ func extractFailure(wso workspaceObjects) (string, *api.WorkspacePhase) {
576576
return reason, nil
577577
}
578578

579-
tpe, err := wso.WorkspaceType()
580-
if err != nil {
581-
log.WithError(err).Warn("cannot determine workspace type - assuming this is a regular")
582-
tpe = api.WorkspaceType_REGULAR
583-
}
584-
585579
status := pod.Status
586580
if status.Phase == corev1.PodFailed && (status.Reason != "" || status.Message != "") {
587581
// Don't force the phase to UNKNONWN here to leave a chance that we may detect the actual phase of
@@ -621,8 +615,8 @@ func extractFailure(wso workspaceObjects) (string, *api.WorkspacePhase) {
621615
return fmt.Sprintf("container %s ran with an error: exit code %d", cs.Name, terminationState.ExitCode), nil
622616
}
623617
} else if terminationState.Reason == "Completed" {
624-
if tpe == api.WorkspaceType_PREBUILD {
625-
// default way for prebuilds to be done
618+
if wso.IsWorkspaceHeadless() {
619+
// default way for headless workspaces to be done
626620
return "", nil
627621
}
628622
return fmt.Sprintf("container %s completed; containers of a workspace pod are not supposed to do that", cs.Name), nil
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"status": {
3+
"id": "0dd5700a790e7ca2-95291c91f6e61c2e-e06ba50b",
4+
"metadata": {
5+
"owner": "image-builder",
6+
"meta_id": "0dd5700a790e7ca2-95291c91f6e61c2e-e06ba50b",
7+
"started_at": {
8+
"seconds": 1626883365
9+
},
10+
"annotations": {
11+
"baseref": "eu.gcr.io/gitpod-core-dev/registry/base-images:d04c64d5d108632a1768e4af9c3a8a3e6a87c96d2566fb1b0d1aec2fd630e8bd",
12+
"ref": "eu.gcr.io/gitpod-core-dev/registry/workspace-images:a277dab62e839192eb320da283d4e8488a2b2f46fceb4677a7d571431e239aa5"
13+
}
14+
},
15+
"spec": {
16+
"workspace_image": "eu.gcr.io/gitpod-core-dev/build/image-builder-mk3/bob:2cf747867ff804ee0edc0a2607cb8ca06242083a",
17+
"ide_image": "eu.gcr.io/gitpod-core-dev/build/image-builder-mk3/bob:2cf747867ff804ee0edc0a2607cb8ca06242083a",
18+
"headless": true,
19+
"url": "https://0dd5700a790e7ca2-95291c91f6e61c2e-e06ba50b.ws-dev.cw-imgbuilder-mk3-rebase.staging.gitpod-dev.com",
20+
"type": 4,
21+
"timeout": "1h0m0s"
22+
},
23+
"phase": 5,
24+
"conditions": {
25+
"service_exists": 1,
26+
"deployed": 1
27+
},
28+
"message": "headless workspace is stopping",
29+
"runtime": {
30+
"node_name": "gke-dev-workload-1-49d27f81-8s5c",
31+
"pod_name": "imagebuild-0dd5700a790e7ca2-95291c91f6e61c2e-e06ba50b",
32+
"node_ip": "10.132.0.17"
33+
},
34+
"auth": {
35+
"owner_token": "osZStmqg3TI0NrkLe3edax9bYCknXWtr"
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)