Skip syncing the backup which doesn't contain backup metadata
Skip syncing the backup which doesn't contain backup metadata Fixes #6849 Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>pull/7081/head
parent
cb5ffe2753
commit
84c96047b9
|
@ -0,0 +1 @@
|
|||
Skip syncing the backup which doesn't contain backup metadata
|
|
@ -142,6 +142,16 @@ func (b *backupSyncReconciler) Reconcile(ctx context.Context, req ctrl.Request)
|
|||
log = log.WithField("backup", backupName)
|
||||
log.Info("Attempting to sync backup into cluster")
|
||||
|
||||
exist, err := backupStore.BackupExists(location.Spec.ObjectStorage.Bucket, backupName)
|
||||
if err != nil {
|
||||
log.WithError(errors.WithStack(err)).Error("Error checking backup exist from backup store")
|
||||
continue
|
||||
}
|
||||
if !exist {
|
||||
log.Debugf("backup %s doesn't exist in backup store, skip", backupName)
|
||||
continue
|
||||
}
|
||||
|
||||
backup, err := backupStore.GetBackupMetadata(backupName)
|
||||
if err != nil {
|
||||
log.WithError(errors.WithStack(err)).Error("Error getting backup metadata from backup store")
|
||||
|
|
|
@ -429,6 +429,7 @@ var _ = Describe("Backup Sync Reconciler", func() {
|
|||
backupNames = append(backupNames, backup.backup.Name)
|
||||
backupStore.On("GetBackupMetadata", backup.backup.Name).Return(backup.backup, nil)
|
||||
backupStore.On("GetPodVolumeBackups", backup.backup.Name).Return(backup.podVolumeBackups, nil)
|
||||
backupStore.On("BackupExists", "bucket-1", backup.backup.Name).Return(true, nil)
|
||||
}
|
||||
backupStore.On("ListBackups").Return(backupNames, nil)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue