Thanks to visit codestin.com
Credit goes to github.com

Skip to content

implement ASF S3 CORS #7081

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

Merged
merged 5 commits into from
Nov 16, 2022
Merged

implement ASF S3 CORS #7081

merged 5 commits into from
Nov 16, 2022

Conversation

bentsku
Copy link
Contributor

@bentsku bentsku commented Oct 24, 2022

This implements S3 CORS for the new provider.
Current issues with CORS is that we depend on the service name parser to correctly handle CORS depending on the service (S3 and API GW can both manage their own CORS rules).

We make use of the handler chain, with a very early handler which "pre-parse" the request with a simplified way to determine if the request would be directed towards S3. If it does, we then handle CORS based on the configured rules if there are, otherwise default to the LocalStack behaviour for CORS.

Here's a simplified flow chart for how we handle CORS.
(The top right box will actually differ depending on the previous path, but to simplify the chart, it is drawn as one path only).

s3 cors2

@bentsku bentsku temporarily deployed to localstack-ext-tests October 24, 2022 15:38 Inactive
@bentsku bentsku requested a review from dfangl October 24, 2022 15:46
@bentsku bentsku marked this pull request as ready for review October 24, 2022 15:46
@bentsku bentsku temporarily deployed to localstack-ext-tests October 24, 2022 16:16 Inactive
@github-actions
Copy link

github-actions bot commented Oct 24, 2022

LocalStack integration with Pro

       3 files  +    2         3 suites  +2   1h 15m 15s ⏱️ + 25m 38s
1 479 tests +  31  1 260 ✔️ +  35  219 💤 +    6  0 ±0 
2 077 runs  +629  1 626 ✔️ +401  451 💤 +238  0 ±0 

Results for commit 49d3db4. ± Comparison against base commit 62502bf.

♻️ This comment has been updated with latest results.

@bentsku bentsku temporarily deployed to localstack-ext-tests October 25, 2022 09:37 Inactive
@bentsku bentsku temporarily deployed to localstack-ext-tests October 25, 2022 11:30 Inactive
@bentsku bentsku temporarily deployed to localstack-ext-tests October 25, 2022 15:14 Inactive
@coveralls
Copy link

coveralls commented Oct 25, 2022

Coverage Status

Coverage decreased (-0.4%) to 79.494% when pulling 49d3db4 on s3-asf-cors into 62502bf on master.

@bentsku
Copy link
Contributor Author

bentsku commented Oct 25, 2022

(Terraform tests are passing when overriding the ASF provider, see https://github.com/localstack/localstack/actions/runs/3322125332/jobs/5490831947)
Might be some test failures with POST bodies, nothing to do with CORS.

Copy link
Member

@alexrashed alexrashed left a comment

Choose a reason for hiding this comment

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

Wow, this is huge! Thanks for grinding through this particularly complex topic! 🚀
I only have a few questions and some minor nitpicks.

@bentsku bentsku temporarily deployed to localstack-ext-tests October 28, 2022 14:03 Inactive
@bentsku
Copy link
Contributor Author

bentsku commented Oct 28, 2022

Thanks a lot for the thorough review @alexrashed ! I've now pushed the changes that you pointed out, thanks again 🙏

@bentsku bentsku requested a review from alexrashed October 28, 2022 14:03
Copy link
Member

@alexrashed alexrashed 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 addressing all the comments! It's really quite a complex topic. The code coverage goes down a bit, because the new provider isn't the default yet. But the tests are already in place (with lots of snapshots ❤️) and once we switch to the new provider (or add a new parallel test step for the new S3 provider) it will go up quite a bit! 🚀

@bentsku
Copy link
Contributor Author

bentsku commented Nov 11, 2022

I'd love to have a new parallel test step for the ASF provider once we know it's ready and out there for the public. If the code coverage is still too low after that, we can write more unit tests and/or integration on not covered parts.

@bentsku bentsku temporarily deployed to localstack-ext-tests November 11, 2022 09:21 Inactive
Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

fantastic! looks like we're almost there, just a merge conflict to fix :-)

@bentsku bentsku temporarily deployed to localstack-ext-tests November 15, 2022 13:28 Inactive
@bentsku
Copy link
Contributor Author

bentsku commented Nov 15, 2022

I still can't seem to get a full green build, but it seems to be only a timeout related issue. This could be merged 🎉

@bentsku bentsku merged commit db7ab17 into master Nov 16, 2022
@bentsku bentsku deleted the s3-asf-cors branch November 16, 2022 14:02
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.

4 participants