From f5d1d31e43ff797a6718d55b18c963df00526ac6 Mon Sep 17 00:00:00 2001 From: Angel Misevski Date: Wed, 15 Jun 2022 14:50:46 -0400 Subject: [PATCH] Fix issue where deleting a workspace deletes the PVC incorrectly Fix a regression caused by commit cbd3fd11. When deleting workspaces, if there are no non-terminating workspaces left in the namespace, we delete the common PVC rather than running cleanup jobs. However, the way the check was written assumed that we were counting _all_ workspaces, and would delete the common PVC if there were two workspaces in a namespace and one was deleted. Signed-off-by: Angel Misevski --- pkg/provision/storage/commonStorage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/provision/storage/commonStorage.go b/pkg/provision/storage/commonStorage.go index f72ba963f..a1de73494 100644 --- a/pkg/provision/storage/commonStorage.go +++ b/pkg/provision/storage/commonStorage.go @@ -94,7 +94,7 @@ func (p *CommonStorageProvisioner) CleanupWorkspaceStorage(workspace *dw.DevWork // If the number of common + async workspaces that exist (started or stopped) is zero, // delete common PVC instead of running cleanup job - if totalWorkspaces > 1 { + if totalWorkspaces > 0 { return runCommonPVCCleanupJob(workspace, clusterAPI) } else { sharedPVC := &corev1.PersistentVolumeClaim{}