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>
This commit is contained in:
Wenkai Yin(尹文开)
2023-11-10 10:16:47 +08:00
parent cb5ffe2753
commit 84c96047b9
3 changed files with 12 additions and 0 deletions

View File

@@ -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")