Skip to content

Commit

Permalink
fix(backup): pvc storage class could be in annotation
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 6264

Signed-off-by: Jack Lin <jack.lin@suse.com>
(cherry picked from commit 2197626)
  • Loading branch information
ChanYiLin authored and mergify[bot] committed Jul 10, 2023
1 parent fedfefc commit 54f23d2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion controller/backup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,17 @@ func (bc *BackupController) checkMonitor(backup *longhorn.Backup, volume *longho
if kubernetesStatus.PVCName != "" && kubernetesStatus.LastPVCRefAt == "" {
pvc, _ := bc.ds.GetPersistentVolumeClaim(kubernetesStatus.Namespace, kubernetesStatus.PVCName)
if pvc != nil {
storageClassName = *pvc.Spec.StorageClassName
if pvc.Spec.StorageClassName != nil {
storageClassName = *pvc.Spec.StorageClassName
}
if storageClassName == "" {
if v, exist := pvc.Annotations[corev1.BetaStorageClassAnnotation]; exist {
storageClassName = v
}
}
if storageClassName == "" {
bc.logger.Warnf("Failed to find the StorageClassName from the pvc %v", pvc.Name)
}
}
}

Expand Down

0 comments on commit 54f23d2

Please sign in to comment.