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

Add disableHTTPS and usePathStyle s3v2.Options as query param #3491

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

khrm
Copy link
Contributor

@khrm khrm commented Oct 4, 2024

This ensures that we can use blob/blob with s3 compatible storage like minio.
Pass usePathStyle=true to force PathStyle for s3. Pass disableHTTPS=true to disable tls for endpoint.

Please use a title starting with the name of the affected package, or "all",
followed by a colon, followed by a short summary of the issue. Example:
blob/gcsblob: fix typo in documentation.

Fixes: #3490

@khrm
Copy link
Contributor Author

khrm commented Oct 4, 2024

/assign @vangent

aws/aws.go Outdated
// V2s3OptionsFromURLParams.
//
// The following query options are supported:
// - usePathStyle: A value of "true" forces the request to use path-style addressing; sets s3v2.Options.UsePathStyle.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just so I understand -- do these options make sense for all AWS services, or just for S3?

If they make sense for all AWS services, let's update the existing V2ConfigFromURLParams to return an awsv2.Config and a []func(*s3v2.Options), instead of creating a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

s3v2.Options options are used by s3 only.

Copy link
Contributor Author

@khrm khrm Oct 7, 2024

Choose a reason for hiding this comment

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

So I think we need to have a separate function.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it's only used by S3, then let's move this code into blob/s3blob. I.e., see how the "accelerate" option is parsed and used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done that. Please review again.

aws/aws.go Outdated
//
// The following query options are supported:
// - usePathStyle: A value of "true" forces the request to use path-style addressing; sets s3v2.Options.UsePathStyle.
// - disableHTTPS: A value of "true" disables SSL when sending requests; sets s3v2.Options.EndpointOptions.DisableHTTPS.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please follow the existing style for URL parameters, e.g., "use_path_style" and "disable_https".

Let's add support for "no_accelerate" too? (leave the default as true, but allow people to turn it off).

Copy link
Contributor Author

@khrm khrm Oct 7, 2024

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, you're right. But most existing URL parameters are not camelcase, so let's follow that.

I can send a separate PR to fix those.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ignore my comment about "no_accelerate" -- that's already supported.

@@ -199,10 +199,16 @@ func (o *URLOpener) OpenBucketURL(ctx context.Context, u *url.URL) (*blob.Bucket
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do the tests pass? I would expect V2ConfigFromURLParams to fail if you passed it a URL with these new parameters in it.

Copy link
Contributor Author

@khrm khrm Oct 7, 2024

Choose a reason for hiding this comment

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

I have added the following tests to catch this issue:
https://github.com/google/go-cloud/pull/3491/files#diff-0520a4d136ddd4348403e11bf2af92e43dd4dae87d9d970370c795cb966614f6R311

Similarly, in other test:
https://github.com/google/go-cloud/pull/3491/files#diff-0520a4d136ddd4348403e11bf2af92e43dd4dae87d9d970370c795cb966614f6R222

Now, if someone add a new query param in any of the place, this test will be able to catch this issue.

@khrm khrm force-pushed the s3Options branch 5 times, most recently from ba017d3 to 32a9faa Compare October 7, 2024 04:04
@khrm
Copy link
Contributor Author

khrm commented Oct 8, 2024

@vangent Can you review this again?

This ensures that we can use blob/blob with s3 compatible storage like minio.
Pass use_path_style=true to force PathStyle for s3.
Pass disable_https=true to disable tls for endpoint.
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.

Project coverage is 73.24%. Comparing base (e5b1bc6) to head (0e94b90).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
blob/s3blob/s3blob.go 80.95% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3491   +/-   ##
=======================================
  Coverage   73.23%   73.24%           
=======================================
  Files         113      113           
  Lines       15018    15037   +19     
=======================================
+ Hits        10999    11014   +15     
- Misses       3257     3259    +2     
- Partials      762      764    +2     

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

@vangent vangent merged commit af4c9dd into google:master Oct 9, 2024
6 checks passed
@khrm khrm deleted the s3Options branch October 9, 2024 17:59
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.

No way to support blob/blob in compatible storage like minio with v2 aws sdkgo
2 participants