pb-2113: Setting storageclass to nil in pvc, if it is empty.
- The default storageclass configured on the setup, will be
picked up, only when the storageclass is not set.
- Emptystring as pvc storageclass will not select
the default storageclass configured on the cluster.
@@ -514,6 +514,13 @@ func (k *kdmp) getRestorePVCs(
if val, ok := restore.Spec.StorageClassMapping[sc]; ok {
pvc.Spec.StorageClassName = &val
}
+ // If pvc storageClassName is empty, we want to pick up the
+ // default storageclass configured on the cluster.
+ // Default storage class will not selected, if the storageclass
+ // is empty. So setting it to nil.
+ if len(*pvc.Spec.StorageClassName) == 0 {
+ pvc.Spec.StorageClassName = nil
+ }
pvc.Spec.VolumeName = ""
if pvc.Annotations != nil {
delete(pvc.Annotations, bindCompletedKey)
