From 40a1b62c09f2a1bdb38b05a0439119f613f0ba22 Mon Sep 17 00:00:00 2001 From: Jalaja Date: Tue, 23 Mar 2021 19:16:37 +0000 Subject: [PATCH] use region input to detect the Bucket region Signed-off-by: Jalaja Ganapathy Signed-off-by: Jalaja --- changelogs/unreleased/3617-jala-dx | 1 + pkg/restic/config.go | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/unreleased/3617-jala-dx diff --git a/changelogs/unreleased/3617-jala-dx b/changelogs/unreleased/3617-jala-dx new file mode 100644 index 000000000..425fcd08c --- /dev/null +++ b/changelogs/unreleased/3617-jala-dx @@ -0,0 +1 @@ +Region is calculated incorrectly when gov account is used. diff --git a/pkg/restic/config.go b/pkg/restic/config.go index 452adbc0c..be207506e 100644 --- a/pkg/restic/config.go +++ b/pkg/restic/config.go @@ -64,10 +64,14 @@ func getRepoPrefix(location *velerov1api.BackupStorageLocation) (string, error) switch backendType { case AWSBackend: var url string + var region string switch { // non-AWS, S3-compatible object store case location.Spec.Config["s3Url"] != "": url = location.Spec.Config["s3Url"] + case location.Spec.Config["region"] != "": + region = location.Spec.Config["region"] + url = fmt.Sprintf("s3-%s.amazonaws.com", region) default: region, err := getAWSBucketRegion(bucket) if err != nil {