From 0ebdbf5ddbff1579f7f01a0b30120a6a28427b19 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Wed, 25 May 2022 16:31:07 -0400 Subject: [PATCH] [ws-manager] Check the pod contains a workspace class and exists --- components/ws-manager/pkg/manager/monitor.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/ws-manager/pkg/manager/monitor.go b/components/ws-manager/pkg/manager/monitor.go index 505af28e88df3e..bbfd27d8305d44 100644 --- a/components/ws-manager/pkg/manager/monitor.go +++ b/components/ws-manager/pkg/manager/monitor.go @@ -894,11 +894,15 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb ) if wso.Pod != nil { _, pvcFeatureEnabled = wso.Pod.Labels[pvcWorkspaceFeatureAnnotation] - wsClassName := "" + if _, ok := wso.Pod.Labels[workspaceClassLabel]; ok { - wsClassName = wso.Pod.Labels[workspaceClassLabel] + wsClassName := wso.Pod.Labels[workspaceClassLabel] + + workspaceClass := m.manager.Config.WorkspaceClasses[wsClassName] + if workspaceClass != nil { + pvcVolumeSnapshotClassName = workspaceClass.PVC.SnapshotClass + } } - pvcVolumeSnapshotClassName = m.manager.Config.WorkspaceClasses[wsClassName].PVC.SnapshotClass } doBackup := wso.WasEverReady() && !wso.IsWorkspaceHeadless()