Skip to content

Commit fe904f9

Browse files
aledbfroboquat
authored andcommitted
[ws-manager] Check the pod contains a workspace class and exists
1 parent 9fa1375 commit fe904f9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -894,11 +894,15 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
894894
)
895895
if wso.Pod != nil {
896896
_, pvcFeatureEnabled = wso.Pod.Labels[pvcWorkspaceFeatureAnnotation]
897-
wsClassName := ""
897+
898898
if _, ok := wso.Pod.Labels[workspaceClassLabel]; ok {
899-
wsClassName = wso.Pod.Labels[workspaceClassLabel]
899+
wsClassName := wso.Pod.Labels[workspaceClassLabel]
900+
901+
workspaceClass := m.manager.Config.WorkspaceClasses[wsClassName]
902+
if workspaceClass != nil {
903+
pvcVolumeSnapshotClassName = workspaceClass.PVC.SnapshotClass
904+
}
900905
}
901-
pvcVolumeSnapshotClassName = m.manager.Config.WorkspaceClasses[wsClassName].PVC.SnapshotClass
902906
}
903907

904908
doBackup := wso.WasEverReady() && !wso.IsWorkspaceHeadless()

0 commit comments

Comments
 (0)