mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-05 04:55:22 +00:00
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:
1
changelogs/unreleased/7081-ywk253100
Normal file
1
changelogs/unreleased/7081-ywk253100
Normal file
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user