Skip to content

Commit

Permalink
Skip creation of Virtualization SC in Provider Mode
Browse files Browse the repository at this point in the history
- StorageClasses should only be created by StorageClassRequests when
StorageConsumers are allowed, i.e in Provider mode
- This commit skips virt sc creation if consumers are allowed in
StorageCluster CR

Signed-off-by: Leela Venkaiah G <[email protected]>
  • Loading branch information
leelavg authored and nb-ohad committed Nov 21, 2023
1 parent a7a3af1 commit 03b7e52
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions controllers/storagecluster/storageclasses.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,17 @@ func (r *StorageClusterReconciler) newStorageClassConfigurations(initData *ocsv1
newCephFilesystemStorageClassConfiguration(initData),
newCephBlockPoolStorageClassConfiguration(initData),
}
// If kubevirt crd is present, we create a specialized rbd storageclass for virtualization environment
kvcrd := &extv1.CustomResourceDefinition{}
err := r.Client.Get(context.TODO(), types.NamespacedName{Name: "virtualmachines.kubevirt.io", Namespace: ""}, kvcrd)
if err == nil {
ret = append(ret, newCephBlockPoolVirtualizationStorageClassConfiguration(initData))

// when allowing consumers, creation of storage classes should only be done via storageclassrequests
if !initData.Spec.AllowRemoteStorageConsumers {
// If kubevirt crd is present, we create a specialized rbd storageclass for virtualization environment
kvcrd := &extv1.CustomResourceDefinition{}
err := r.Client.Get(context.TODO(), types.NamespacedName{Name: "virtualmachines.kubevirt.io", Namespace: ""}, kvcrd)
if err == nil {
ret = append(ret, newCephBlockPoolVirtualizationStorageClassConfiguration(initData))
}
}

if initData.Spec.ManagedResources.CephNonResilientPools.Enable {
ret = append(ret, newNonResilientCephBlockPoolStorageClassConfiguration(initData))
}
Expand Down

0 comments on commit 03b7e52

Please sign in to comment.