-
Notifications
You must be signed in to change notification settings - Fork 713
cloud_storage_clients: make s3 url style optional #29454
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -509,7 +509,7 @@ request_creator::make_gcs_batch_delete_request( | |
| } | ||
|
|
||
| std::string request_creator::make_host(const plain_bucket_name& name) const { | ||
| switch (_ap_style) { | ||
| switch (_ap_style.value()) { | ||
nvartolomei marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
| case s3_url_style::virtual_host: | ||
| // Host: bucket-name.s3.region-code.amazonaws.com | ||
| return fmt::format("{}.{}", name(), _ap()); | ||
|
|
@@ -521,7 +521,7 @@ std::string request_creator::make_host(const plain_bucket_name& name) const { | |
|
|
||
| std::string request_creator::make_target( | ||
| const plain_bucket_name& name, const object_key& key) const { | ||
| switch (_ap_style) { | ||
| switch (_ap_style.value()) { | ||
nvartolomei marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a It seems reasonable to assume that this will always have a value in normal
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This throws already but you want to crash the process instead on invariant violation?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For CI, why not. I don't feel super strongly so if you want to leave as is that's fine too. |
||
| case s3_url_style::virtual_host: | ||
| // Target: /homepage.html | ||
| return fmt::format("/{}", key().string()); | ||
|
|
@@ -907,8 +907,6 @@ s3_client::s3_client( | |
|
|
||
| ss::future<result<client_self_configuration_output, error_outcome>> | ||
| s3_client::self_configure() { | ||
| auto result = s3_self_configuration_result{ | ||
| .url_style = s3_url_style::virtual_host}; | ||
| // Oracle cloud storage only supports path-style requests | ||
| // (https://www.oracle.com/ca-en/cloud/storage/object-storage/faq/#category-amazon), | ||
| // but self-configuration will misconfigure to virtual-host style due to a | ||
|
|
@@ -926,17 +924,15 @@ s3_client::self_configure() { | |
| if ( | ||
| backend == model::cloud_storage_backend::oracle_s3_compat | ||
| || backend == model::cloud_storage_backend::minio) { | ||
| result.url_style = s3_url_style::path; | ||
| co_return result; | ||
| co_return s3_self_configuration_result{.url_style = s3_url_style::path}; | ||
| } | ||
|
|
||
| // Also handle possibly inferred backend. | ||
| auto inferred_backend = infer_backend_from_uri(_requestor._ap); | ||
| if ( | ||
| inferred_backend == model::cloud_storage_backend::oracle_s3_compat | ||
| || inferred_backend == model::cloud_storage_backend::minio) { | ||
| result.url_style = s3_url_style::path; | ||
| co_return result; | ||
| co_return s3_self_configuration_result{.url_style = s3_url_style::path}; | ||
| } | ||
|
|
||
| // Test virtual host style addressing, fall back to path if necessary. | ||
|
|
@@ -948,10 +944,11 @@ s3_client::self_configure() { | |
| if (!bucket_config.value().has_value()) { | ||
| vlog( | ||
| s3_log.warn, | ||
| "Could not self-configure S3 Client, {} is not set. Defaulting to {}", | ||
| bucket_config.name(), | ||
| result.url_style); | ||
| co_return result; | ||
| "Could not self-configure S3 Client, {} is not set. Defaulting to " | ||
| "virtual_host", | ||
| bucket_config.name()); | ||
| co_return s3_self_configuration_result{ | ||
| .url_style = s3_url_style::virtual_host}; | ||
| } | ||
|
|
||
| // TODO: Review this code. It is likely buggy when Remote Read Replicas are | ||
|
|
@@ -963,12 +960,15 @@ s3_client::self_configure() { | |
|
|
||
| // Test virtual_host style. | ||
| vassert( | ||
| _requestor._ap_style == s3_url_style::virtual_host, | ||
| "_ap_style should be virtual host by default before self configuration " | ||
| !_requestor._ap_style.has_value() | ||
| || _requestor._ap_style == s3_url_style::virtual_host, | ||
| "_ap_style should be unset or virtual host before self configuration " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assert seems fairly useless, looking back on it. Could be removed.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It makes sense to me to keep it for now. There are some footguns which this catches. Ie the fact that even though we attempt self configuring with virtual host we still connect to the server url which is also tried for path style. Ie s3.us-east2... and not bucket.s3.us-east2... So if we were to have url style set to virtual host the path test attempt would have failed. Some bad code here I'm trying to sidestep. |
||
| "begins"); | ||
| _requestor._ap_style = s3_url_style::virtual_host; | ||
| if (co_await self_configure_test(bucket)) { | ||
| // Virtual-host style request succeeded. | ||
| co_return result; | ||
| // Virtual host style request succeeded. | ||
| co_return s3_self_configuration_result{ | ||
| .url_style = s3_url_style::virtual_host}; | ||
| } | ||
|
|
||
| // fips mode can only work in virtual_host mode, so if the above test failed | ||
|
|
@@ -980,10 +980,9 @@ s3_client::self_configure() { | |
|
|
||
| // Test path style. | ||
| _requestor._ap_style = s3_url_style::path; | ||
| result.url_style = _requestor._ap_style; | ||
| if (co_await self_configure_test(bucket)) { | ||
| // Path style request succeeded. | ||
| co_return result; | ||
| co_return s3_self_configuration_result{.url_style = s3_url_style::path}; | ||
| } | ||
|
|
||
| // Both addressing styles failed. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.