Skip to content

Commit

Permalink
CR fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
  • Loading branch information
arnongilboa committed Oct 9, 2023
1 parent 7fad7e9 commit 1f6fa85
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/controller/clone/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,17 @@ func GetStorageClassForClaim(ctx context.Context, c client.Client, pvc *corev1.P
}

func getSnapshotClassForClaim(ctx context.Context, c client.Client, pvc *corev1.PersistentVolumeClaim) (*string, error) {
if pvc.Spec.StorageClassName == nil || *pvc.Spec.StorageClassName == "" {
return nil, nil
scName := pvc.Spec.StorageClassName
if scName == nil {
sc, err := cc.GetDefaultStorageClass(ctx, c)
if err != nil || sc == nil {
return nil, err
}
scName = &sc.Name
}

sp := &cdiv1.StorageProfile{}
exists, err := getResource(ctx, c, "", *pvc.Spec.StorageClassName, sp)
exists, err := getResource(ctx, c, "", *scName, sp)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1f6fa85

Please sign in to comment.