Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip syncing the backup which doesn't contain backup metadata #7081

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/unreleased/7081-ywk253100
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Skip syncing the backup which doesn't contain backup metadata
10 changes: 10 additions & 0 deletions pkg/controller/backup_sync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@
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

Check warning on line 148 in pkg/controller/backup_sync_controller.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/backup_sync_controller.go#L147-L148

Added lines #L147 - L148 were not covered by tests
}
if !exist {
log.Debugf("backup %s doesn't exist in backup store, skip", backupName)
continue

Check warning on line 152 in pkg/controller/backup_sync_controller.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/backup_sync_controller.go#L151-L152

Added lines #L151 - L152 were not covered by tests
}

backup, err := backupStore.GetBackupMetadata(backupName)
if err != nil {
log.WithError(errors.WithStack(err)).Error("Error getting backup metadata from backup store")
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/backup_sync_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading