Skip to content

Commit 795e462

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

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,15 @@ func (m *Manager) StartWorkspace(ctx context.Context, req *api.StartWorkspaceReq
351351
if err != nil {
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) {
354+
// this could be an error due to a scale-up event, delete the PVC object if present
355+
delErr := m.deleteWorkspacePVC(ctx, pod.Name)
356+
if delErr != nil {
357+
clog.WithError(delErr).WithField("pvc", pod.Name).Warn("was unable to delete workspace pvc")
358+
// do not return error to keep run the following logic
359+
}
360+
354361
// this could be an error due to a scale-up event
355-
delErr := deleteWorkspacePodForce(m.Clientset, pod.Name, pod.Namespace)
362+
delErr = deleteWorkspacePodForce(m.Clientset, pod.Name, pod.Namespace)
356363
if delErr != nil {
357364
clog.WithError(delErr).WithField("pod", pod.Name).Warn("was unable to delete workspace pod")
358365
return nil, xerrors.Errorf("workspace pod never reached Running state: %w", err)

0 commit comments

Comments
 (0)