Skip to content

Commit 70b000a

Browse files
committed
ws-manager: remove PVC once the workspace pod is unschedulable
Signed-off-by: JenTing Hsiao <[email protected]>
1 parent 449bcc2 commit 70b000a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,15 @@ func (m *Manager) StartWorkspace(ctx context.Context, req *api.StartWorkspaceReq
352352
clog.WithError(err).WithField("pod", pod.Name).Warn("workspace pod did not transition to running state")
353353
if err == wait.ErrWaitTimeout && isPodUnschedulable(m.Clientset, pod.Name, pod.Namespace) {
354354
// this could be an error due to a scale-up event
355-
delErr := deleteWorkspacePodForce(m.Clientset, pod.Name, pod.Namespace)
355+
// delete the PVC object if present
356+
delErr := m.deleteWorkspacePVC(ctx, pod.Name)
357+
if delErr != nil {
358+
clog.WithError(delErr).WithField("pvc", pod.Name).Warn("was unable to delete workspace pvc")
359+
// do not return error to run the following logic
360+
}
361+
362+
// force delete the workspace pod by removing the finalizer
363+
delErr = deleteWorkspacePodForce(m.Clientset, pod.Name, pod.Namespace)
356364
if delErr != nil {
357365
clog.WithError(delErr).WithField("pod", pod.Name).Warn("was unable to delete workspace pod")
358366
return nil, xerrors.Errorf("workspace pod never reached Running state: %w", err)

0 commit comments

Comments
 (0)