Skip to content

Commit

Permalink
Update restore controller logic for restore deletion
Browse files Browse the repository at this point in the history
1. Skip deleting the restore files from storage if the backup/BSL is not found
2. Allow deleting the restore files from storage even though the BSL is readonly

Signed-off-by: Wenkai Yin(尹文开) <[email protected]>
  • Loading branch information
ywk253100 committed Sep 5, 2023
1 parent 6790a18 commit e4c9594
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/6761-ywk253100
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update restore controller logic for restore deletion
9 changes: 4 additions & 5 deletions pkg/controller/restore_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,14 +671,13 @@ func (r *restoreReconciler) deleteExternalResources(restore *api.Restore) error

backupInfo, err := r.fetchBackupInfo(restore.Spec.BackupName)
if err != nil {
if apierrors.IsNotFound(err) {
r.logger.Errorf("got not found error: %v, skip deleting the restore files in object storage", err)
return nil
}
return errors.Wrap(err, fmt.Sprintf("can't get backup info, backup: %s", restore.Spec.BackupName))
}

// if storage locations is read-only, skip deletion
if backupInfo.location.Spec.AccessMode == api.BackupStorageLocationAccessModeReadOnly {
return nil
}

// delete restore files in object storage
pluginManager := r.newPluginManager(r.logger)
defer pluginManager.CleanupClients()
Expand Down

0 comments on commit e4c9594

Please sign in to comment.