Fix restore error with flag namespace-mappings (#5377)

Signed-off-by: Ming <mqiu@vmware.com>
This commit is contained in:
qiuming
2022-09-29 11:54:51 +08:00
committed by GitHub
parent 3b3260c1c3
commit eacc10347b
7 changed files with 18 additions and 5 deletions
@@ -249,8 +249,10 @@ func (c *PodVolumeRestoreReconciler) processRestore(ctx context.Context, req *ve
return errors.Wrap(err, "error getting backup storage location")
}
// need to check backup repository in source namespace rather than in pod namespace
// such as in case of namespace mapping issue
backupRepo, err := repository.GetBackupRepository(ctx, c.Client, req.Namespace, repository.BackupRepositoryKey{
VolumeNamespace: req.Spec.Pod.Namespace,
VolumeNamespace: req.Spec.SourceNamespace,
BackupLocation: req.Spec.BackupStorageLocation,
RepositoryType: podvolume.GetPvrRepositoryType(req),
})