-
Notifications
You must be signed in to change notification settings - Fork 167
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
feat: added dynamic bucket region session option #146
feat: added dynamic bucket region session option #146
Conversation
0b47213
to
11e8186
Compare
04dd07b
to
bd2e2cb
Compare
Codecov Report
@@ Coverage Diff @@
## master #146 +/- ##
==========================================
+ Coverage 40.80% 45.01% +4.20%
==========================================
Files 18 18
Lines 272 291 +19
==========================================
+ Hits 111 131 +20
+ Misses 151 150 -1
Partials 10 10
Continue to review full report at Codecov.
|
095137c
to
eda2008
Compare
34056db
to
d9df9f3
Compare
d9df9f3
to
35d06fe
Compare
35d06fe
to
c21ba4e
Compare
@hypnoglow please take a look at this when you can. Update: Couldn't wait any longer for the feature to be merged upstream, so I had to fit our fork for use, release a version there and use it instead. |
This is a great feature, thanks a lot! |
Scope
Minor (Feature)
What
Why
Without the correct region being set currently the plugin throws an error:
We wanted to allow the plugin to work without manual region setting and also support multiple repositories residing in different regions without updating the regions in-between fetching charts from those repositories. This is especially relevant when the plugin is used in a Terraform environment.
How
The
HEAD {{bucket}}
request allows querying the bucket's actual region without prior knowledge with the proper configuration.Unfortunately this behavior is not explicitly documented - or at least I couldn't find it - but the AWS SDK Go team confirmed in an issue comment this is an intended and supported behavior of the endpoint.
If the option runs into any issue, it has no effect on the session/configuration as a fallback mechanism. In such a case the plugin's behavior remains the same as before, namely falling back to the
HELM_S3_REGION
environment variable's value or to the corresponding AWS environment variable's value (AWS_REGION
orAWS_DEFAULT_REGION
).Notes
The buckets used in the unit tests were found randomly, they are not mine and I do not have access to them, but they fit the test cases perfectly. They can be replaced with different bucket names if preferred.
I ran into issues when I tried to run the end to end tests, the local variant didn't work with my macOS Big Sur machine and the non-local variant didn't like the AWS users I tried to use it with so I couldn't run those tests myself.
The added unit tests should prove the solution works as expected.
Also the option can be trivially extracted to a self-contained test to run outside the plugin for more advanced testing purposes.
I also tested manually by installing the development version of the plugin and fetching a chart from an S3 repository in a different region than the set one.
I ran these tests on my buckets which had a fine-grained permission policy blocking public request to reassure the solution works for those buckets as well.