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

feat(aws_s3 sink): add option to use virtual addressing #21999

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

sam6258
Copy link
Contributor

@sam6258 sam6258 commented Dec 10, 2024

Summary

The following PR adds an option to enable virtual host style addressing to an s3 sink. The force_path_style option defaults to true for backwards compatibility and may eventually be desired to default to false 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

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

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?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Please read our Vector contributor resources.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run dd-rust-license-tool write to regenerate the license inventory and commit the changes (if any). More details here.

References

@sam6258 sam6258 requested review from a team as code owners December 10, 2024 06:10
@github-actions github-actions bot added domain: sources Anything related to the Vector's sources domain: sinks Anything related to the Vector's sinks domain: external docs Anything related to Vector's external, public documentation labels Dec 10, 2024
@sam6258 sam6258 force-pushed the sam6258/vhost-buckets branch from 207f753 to 30feaa4 Compare December 10, 2024 06:13
@sam6258 sam6258 force-pushed the sam6258/vhost-buckets branch from 30feaa4 to 5ebb457 Compare December 10, 2024 06:16
Copy link
Member

@jszwedko jszwedko left a 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.

@jszwedko
Copy link
Member

@sam6258
Copy link
Contributor Author

sam6258 commented Dec 10, 2024

Do you think it'd be possible to add an integration test that uses the virtual addressing style?

@jszwedko working on this! My editor didn't let me know I broke integration tests in the call to create_service too. Is it possible to enable tests to run on this PR? I'm working on getting my dev env setup to run integration tests in the meantime.

@sam6258 sam6258 changed the title feat(aws_sdk): add option to use virtual addressing feat(aws_s3): add option to use virtual addressing Dec 10, 2024
@pront
Copy link
Member

pront commented Dec 10, 2024

Do you think it'd be possible to add an integration test that uses the virtual addressing style?

@jszwedko working on this! My editor didn't let me know I broke integration tests in the call to create_service too. Is it possible to enable tests to run on this PR? I'm working on getting my dev env setup to run integration tests in the meantime.

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

@sam6258
Copy link
Contributor Author

sam6258 commented Dec 11, 2024

Adapted the integration tests for the new function call structure and added s3_healthchecks_vhost, but I'm getting a lot of test timeouts locally for some reason. Will dig into a bit, since I can't run all the tests I need, but I think the current commit should get us what we want.

@sam6258 sam6258 force-pushed the sam6258/vhost-buckets branch 2 times, most recently from 3e95f13 to a6a184e Compare December 12, 2024 08:45
@pront pront changed the title feat(aws_s3): add option to use virtual addressing feat(aws_s3 sink): add option to use virtual addressing Dec 12, 2024
@sam6258 sam6258 force-pushed the sam6258/vhost-buckets branch from a6a184e to d03f11b Compare December 12, 2024 19:11
@sam6258
Copy link
Contributor Author

sam6258 commented Dec 12, 2024

@pront I fixed the CI check that was failing if you can kick off again, thanks!

@pront
Copy link
Member

pront commented Dec 12, 2024

@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?

@sam6258
Copy link
Contributor Author

sam6258 commented Dec 12, 2024

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)

Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

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

Thanks @sam6258

@ADustyOldMuffin
Copy link

Is there anything else we need to do to get this merged?

@pront
Copy link
Member

pront commented Dec 13, 2024

Is there anything else we need to do to get this merged?

Leaving it this up to @jszwedko, due to this thread:
#21999 (comment)

Copy link
Member

@jszwedko jszwedko left a 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.

src/aws/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

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

Thanks @sam6258 ! This looks much better. Just one last minor comment. Otherwise I think this is good to go.

src/common/s3.rs Outdated
Comment on lines 15 to 17
if let Some(true) = self.force_path_style {
builder = builder.force_path_style(true);
}
Copy link
Member

Choose a reason for hiding this comment

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

I think you could avoid the if let Some if you just do: builder = builder.set_force_path_style(self.force_path_style). The set_* variants on the AWS SDK take Options.

Copy link
Contributor Author

@sam6258 sam6258 Dec 19, 2024

Choose a reason for hiding this comment

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

Done! I opted to use force_path_style still so I could unwrap to true by default in case someone forgets to set the value in S3ClientBuilder. That way it maintains vector's previous behavior even in a programming error.

Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

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

Nice work @sam6258 !

@jszwedko jszwedko enabled auto-merge December 19, 2024 22:24
@jszwedko jszwedko added this pull request to the merge queue Dec 19, 2024
Merged via the queue into vectordotdev:master with commit 029a2ff Dec 20, 2024
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: external docs Anything related to Vector's external, public documentation domain: sinks Anything related to the Vector's sinks domain: sources Anything related to the Vector's sources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants