Skip to content
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

Support AWS_ENDPOINT_URL #84

Merged
merged 3 commits into from
Dec 16, 2024
Merged

Support AWS_ENDPOINT_URL #84

merged 3 commits into from
Dec 16, 2024

Conversation

aykut-bozkurt
Copy link
Collaborator

@aykut-bozkurt aykut-bozkurt commented Dec 6, 2024

  • Supports AWS_ENDPOINT_URL, e.g. you can set AWS_ENDPOINT_URL=http://localhost:9000 and AWS_ALLOW_HTTP=true for local MinIO Server.
  • We were already supporting AWS_SESSION_TOKEN without documentation and tests. Added them.
    As a side note, not automatically AssumeRole to fetch the token, but when passed from environment or config, authentication succeeds with temporary token.

Closes #83.

@aykut-bozkurt aykut-bozkurt force-pushed the aykut/aws-url-endpoint branch from b0dc4e0 to fcd0d85 Compare December 6, 2024 00:50
@aykut-bozkurt aykut-bozkurt changed the title Support AWS_URL_ENDPOINT Support AWS_ENDPOINT_URL Dec 6, 2024
Copy link

codecov bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 98.90110% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.18%. Comparing base (4086ea4) to head (8f812ed).

Files with missing lines Patch % Lines
src/arrow_parquet/uri_utils.rs 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #84      +/-   ##
==========================================
+ Coverage   92.15%   92.18%   +0.02%     
==========================================
  Files          71       71              
  Lines        9040     9087      +47     
==========================================
+ Hits         8331     8377      +46     
- Misses        709      710       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// AWS_ALLOW_HTTP
if let Ok(aws_allow_http) = std::env::var("AWS_ALLOW_HTTP") {
aws_s3_builder = aws_s3_builder
.with_allow_http(aws_allow_http.parse().unwrap_or_else(|e| panic!("{}", e)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the unwrap_or_else be expect!?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(format!()) gives lint errors but we might use unwrap or give additional context with unwrap_or_else

if let Ok(aws_allow_http) = std::env::var("AWS_ALLOW_HTTP") {
aws_s3_builder = aws_s3_builder
.with_allow_http(aws_allow_http.parse().unwrap_or_else(|e| panic!("{}", e)));
};

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably good to add some context in a comment on why we have this additional logic

at this point, I don't have a very good mental model of what object_store does and does not do for us.

Copy link
Collaborator Author

@aykut-bozkurt aykut-bozkurt Dec 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment to the function.

Allowed passing the environment variables to object_store as it is. I was not passing them since we do not read all corresponding configs from the config file (at fallback) but now I see no downside passing all the env vars (except some of the configs, that can be read from environment, cannot be read from the config file. Supported configs by both environment and config files are documented at readme). (context: object_store can not read from config files)

}
// AWS_REGION
if let Some(aws_region) = sdk_config.region() {
aws_s3_builder = aws_s3_builder.with_region(aws_region.as_ref());
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this code also cover other paths like using the EC2 metadata server to obtain credentials?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When all required environment variables are configured to auth via EC2 server, object_store supports it. But we do not read some of the environment variables from the config.

@@ -89,7 +89,7 @@ jobs:
- name: Install and configure pgrx
run: |
cargo install --locked [email protected]
cargo pgrx init --pg${{ env.PG_MAJOR }} $(which pg_config)
cargo pgrx init --pg${{ env.PG_MAJOR }} /usr/lib/postgresql/${{ env.PG_MAJOR }}/bin/pg_config
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest ubuntu CI runner is probably changed and default postgres version is different. To be stable on that, lets specify pg_config absolute path

Copy link
Collaborator

@marcoslot marcoslot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I find the new flow easier to follow.

@aykut-bozkurt aykut-bozkurt merged commit bab2208 into main Dec 16, 2024
6 checks passed
@aykut-bozkurt aykut-bozkurt deleted the aykut/aws-url-endpoint branch December 16, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support non-AWS S3 compatible endpoints?
2 participants