Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/provision/storage/shared.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -238,15 +238,20 @@ func checkForExistingCommonPVC(namespace string, api sync.ClusterAPI) (string, e

// getSharedPVCWorkspaceCount returns the total number of workspaces which are using a shared PVC
// (i.e the workspaces storage-class attribute is set to "common", "async", or unset which defaults to "common")
// Note that workspaces that are have been deleted (i.e. have a deletion timestamp) are not counted.
func getSharedPVCWorkspaceCount(namespace string, api sync.ClusterAPI) (total int, err error) {
workspaces := &dw.DevWorkspaceList{}
err = api.Client.List(api.Ctx, workspaces, &client.ListOptions{Namespace: namespace})
if err != nil {
return 0, err
}
for _, workspace := range workspaces.Items {
if workspace.DeletionTimestamp != nil {
// Ignore terminating workspaces
continue
}
storageClass := workspace.Spec.Template.Attributes.GetString(constants.DevWorkspaceStorageTypeAttribute, nil)
// Note, if the storageClass attribute isin't set (ie. storageClass == ""), then the storage class being used is "common"
// Note, if the storageClass attribute isn't set (ie. storageClass == ""), then the storage class being used is "common"
if storageClass == constants.AsyncStorageClassType || storageClass == constants.CommonStorageClassType || storageClass == "" {
total++
}
Expand Down