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
use region specified in the BackupStorageLocation spec to detect the Bucket region #3617
Conversation
Signed-off-by: Jalaja Ganapathy <jalaja@replicated.com> Signed-off-by: Jalaja <jalaja@replicated.com>
case location.Spec.Config["region"] != "": | ||
region = location.Spec.Config["region"] | ||
url = fmt.Sprintf("s3-%s.amazonaws.com", region) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified to keep all the region inferring/getting logic together by moving this into the default
case.
default:
region := location.Spec.Config["region"]
var err error
if region == "" {
region, err = getASBucketRegion(bucket)
if err != nil {
url = "s3.amazonaws.com"
break
}
url = fmt.Sprintf("s3-%s.amazonaws.com", region)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get rid of the switch statement altogether and just use an if/else clause. I don't think we want any additional cases here anyhow.
@@ -0,0 +1 @@ | |||
Region is calculated incorrectly when gov account is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please use the PR title as the contents of the changelog?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM.
I have a couple of comments.
Also, please add unit tests for this change.
Hi @jala-dx! Are you able to make the requested changes from @ashish-amarnath? It would be great to get this PR merged :) Thanks! |
case location.Spec.Config["region"] != "": | ||
region = location.Spec.Config["region"] | ||
url = fmt.Sprintf("s3-%s.amazonaws.com", region) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get rid of the switch statement altogether and just use an if/else clause. I don't think we want any additional cases here anyhow.
I tried to make some changes to this branch so we could get this merged but unfortunately maintainers don't have write permission for the branch. I've got another branch locally which includes 40a1b62, so I will close this PR and create a new one with the original commit from this PR and my follow up changes. |
Thank you for contributing to Velero!
Please add a summary of your change
Does your change fix a particular issue?
Fixes #(issue)
#3616
Please indicate you've done the following:
/kind changelog-not-required
.site/content/docs/main
.