-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(aws_s3 sink): add option to use virtual addressing #21999
base: master
Are you sure you want to change the base?
Conversation
207f753
to
30feaa4
Compare
30feaa4
to
5ebb457
Compare
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.
Thanks for this contribution @sam6258 !
Do you think it'd be possible to add an integration test that uses the virtual addressing style? It looks like localstack supports it.
Integration tests are defined here: https://github.com/vectordotdev/vector/blob/master/src/sinks/aws_s3/integration_tests.rs |
@jszwedko working on this! My editor didn't let me know I broke integration tests in the call to |
I enabled the CI checks (because it requires approval by maintainers). Local iterations should be much faster. This might be helpful: https://github.com/vectordotdev/vector/blob/master/scripts/integration/README.md |
Adapted the integration tests for the new function call structure and added |
@@ -467,7 +467,7 @@ async fn create_client_test() -> CloudwatchLogsClient { | |||
let endpoint = Some(cloudwatch_address()); | |||
let proxy = ProxyConfig::default(); | |||
|
|||
create_client::<CloudwatchLogsClientBuilder>(&auth, region, endpoint, &proxy, &None, &None) | |||
create_client::<CloudwatchLogsClientBuilder>(&auth, region, endpoint, &proxy, &None, &None, true) |
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.
I think this means we will only test with virtual path style addressing. Could we make sure we have at least one test using each style?
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.
force_path_style
set to true
should mean the previous behavior, not virtual host. Most of the components don't even use the value, they just needed the builder implemented with it.
Still digging into integration failures as it seems at least some might be related to changes in the PR
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.
I got the integration tests working locally and pushed the changes. I had some incorrect values in the test client configs.
On a side note, I did not end up adding an integration test for virtual host style access. This proved more difficult than initially intended as it requires wildcard DNS which docker compose does not support easily. Localstack does support virtual host based lookups and I was able to set up the sdk to do so, but it fails on resolution of the actual bucket. I think wildcard DNS might be out of the scope of this PR.
What are your thoughts here?
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.
Here is the branch I was playing with if interested https://github.com/sam6258/vector/tree/sam6258/vhost-buckets-test
3e95f13
to
a6a184e
Compare
Signed-off-by: Scott Miller <smiller1@coreweave.com>
a6a184e
to
d03f11b
Compare
@pront I fixed the CI check that was failing if you can kick off again, thanks! |
Is PR now ready for a final review? There has been difficulty with getting an IT running? |
Yes, PR in my opinion is ready for final review. It passes existing tests, but I wasn't able to get a test to cover the new functionality per this comment. #21999 (comment) |
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.
Thanks @sam6258
Is there anything else we need to do to get this merged? |
Leaving it this up to @jszwedko, due to this thread: |
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.
Thanks @sam6258 ! I see that it'd be difficult to add an integration test due to the necessity of docker-compose supporting wildcard domains. In this case, I think we can just rely on the SDK to do the right thing.
I left one comment about changing the way the configuration is injected, but otherwise I think this looks good to go.
@@ -124,6 +124,9 @@ pub trait ClientBuilder { | |||
|
|||
/// Build the client using the given config settings. | |||
fn build(config: &SdkConfig) -> Self::Client; | |||
|
|||
/// Build the client using the given config settings and path style addressing. | |||
fn build_and_force_path_style(config: &aws_types::SdkConfig) -> Self::Client; |
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.
I'm not wild about having an S3 specific method on this generic trait.
What would think of, instead of adding this method here, adding a field to
Line 5 in 475e93f
pub(crate) struct S3ClientBuilder; |
force_path_style
?
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.
Yeah, I wasn't crazy about this either, but lacking rust skills here didn't know how else to achieve this. Would that look something like this?
pub(crate) struct S3ClientBuilder{
// field here?
}
impl ClientBuilder for S3ClientBuilder {
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.
Yeah, I think it'd be something like that. Then you'll need to add &self
to the build()
method. I'm happy to play around with it if you get stuck. Hopefully the compiler pushes you in the right directions.
Summary
The following PR adds an option to enable virtual host style addressing to an s3 sink. The
force_path_style
option defaults totrue
for backwards compatibility and may eventually be desired to default tofalse
as path style addressing will eventually be removed from aws s3.This is my first Rust and first Vector PR, so please correct me on any contribution guidelines, style semantics, and code patterns!
Change Type
Is this a breaking change?
How did you test this PR?
I pointed an aws s3 sink at my object storage service and validated both path style and vhost style addressing works and also has the correct
authority
in access logs.Does this PR include user facing changes?
Checklist
Cargo.lock
), pleaserun
dd-rust-license-tool write
to regenerate the license inventory and commit the changes (if any). More details here.References