Skip to content

Commit

Permalink
For PVCRestore PVCs, use default storage class correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
sgielen committed Aug 6, 2024
1 parent 5acd542 commit f6fca25
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/controller/pvcrestore_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func (r *PVCRestoreReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return ctrl.Result{}, err
}

var volumeClass *string
if r.BackupSettings.VolumeClass != "" {
volumeClass = &r.BackupSettings.VolumeClass
}
pvc = corev1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Name: restore.Spec.TargetPVC,
Expand All @@ -98,7 +102,7 @@ func (r *PVCRestoreReconciler) Reconcile(ctx context.Context, req ctrl.Request)
},
},
Spec: corev1.PersistentVolumeClaimSpec{
StorageClassName: &r.BackupSettings.VolumeClass,
StorageClassName: volumeClass,
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},
Resources: corev1.VolumeResourceRequirements{
Requests: map[corev1.ResourceName]resource.Quantity{
Expand Down

0 comments on commit f6fca25

Please sign in to comment.