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>
  • Loading branch information
ChanYiLin committed Jul 10, 2023
1 parent 6f809b3 commit 9b14105
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 9b14105

Please sign in to comment.