-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](Azure)Fix Azure endpoint detection for sovereign clouds with force-global config support #60903
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: master
Are you sure you want to change the base?
[fix](Azure)Fix Azure endpoint detection for sovereign clouds with force-global config support #60903
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 |
|---|---|---|
|
|
@@ -372,13 +372,9 @@ int S3Accessor::init() { | |
| options.Retry.MaxRetries = config::max_s3_client_retry; | ||
| auto cred = | ||
| std::make_shared<Azure::Storage::StorageSharedKeyCredential>(conf_.ak, conf_.sk); | ||
| if (config::force_azure_blob_global_endpoint) { | ||
| uri_ = fmt::format("https://{}.blob.core.windows.net/{}", conf_.ak, conf_.bucket); | ||
| } else { | ||
| uri_ = fmt::format("{}/{}", conf_.endpoint, conf_.bucket); | ||
| if (uri_.find("://") == std::string::npos) { | ||
| uri_ = "https://" + uri_; | ||
| } | ||
| uri_ = fmt::format("{}/{}", conf_.endpoint, conf_.bucket); | ||
|
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 |
||
| if (uri_.find("://") == std::string::npos) { | ||
| uri_ = "https://" + uri_; | ||
| } | ||
| uri_ = normalize_http_uri(uri_); | ||
| // In Azure's HTTP requests, all policies in the vector are called in a chained manner following the HTTP pipeline approach. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3544,13 +3544,27 @@ public static int metaServiceRpcRetryTimes() { | |
| public static int s3_head_request_max_paths = 100; | ||
|
|
||
| @ConfField(mutable = true, description = { | ||
| "此参数控制是否强制使用 Azure global endpoint。默认值为 false,系统将使用用户指定的 endpoint。" | ||
| + "如果设置为 true,系统将强制使用 {account}.blob.core.windows.net。", | ||
| "This parameter controls whether to force the use of the Azure global endpoint. " | ||
| + "The default is false, meaning the system will use the user-specified endpoint. " | ||
| + "If set to true, the system will force the use of {account}.blob.core.windows.net." | ||
| "指定 Azure endpoint 域名后缀白名单(包含 blob 与 dfs),多个值使用逗号分隔。" | ||
| + "默认值为 .blob.core.windows.net,.dfs.core.windows.net," | ||
| + ".blob.core.chinacloudapi.cn,.dfs.core.chinacloudapi.cn," | ||
| + ".blob.core.usgovcloudapi.net,.dfs.core.usgovcloudapi.net," | ||
| + ".blob.core.cloudapi.de,.dfs.core.cloudapi.de。", | ||
| "The host suffix whitelist for Azure endpoints (both blob and dfs), separated by commas. " | ||
| + "The default value is .blob.core.windows.net,.dfs.core.windows.net," | ||
| + ".blob.core.chinacloudapi.cn,.dfs.core.chinacloudapi.cn," | ||
| + ".blob.core.usgovcloudapi.net,.dfs.core.usgovcloudapi.net," | ||
| + ".blob.core.cloudapi.de,.dfs.core.cloudapi.de." | ||
| }) | ||
| public static boolean force_azure_blob_global_endpoint = false; | ||
| public static String[] azure_blob_host_suffixes = { | ||
| ".blob.core.windows.net", | ||
|
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. do we need to keep both why not sth like just core.winodows.com?
Member
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 is required by the HDFS style guidelines. |
||
| ".dfs.core.windows.net", | ||
| ".blob.core.chinacloudapi.cn", | ||
| ".dfs.core.chinacloudapi.cn", | ||
| ".blob.core.usgovcloudapi.net", | ||
| ".dfs.core.usgovcloudapi.net", | ||
| ".blob.core.cloudapi.de", | ||
| ".dfs.core.cloudapi.de" | ||
| }; | ||
|
|
||
| @ConfField(mutable = true, description = {"指定 Jdbc driver url 白名单,举例:jdbc_driver_url_white_list=a,b,c", | ||
| "the white list for jdbc driver url, if it is empty, no white list will be set" | ||
|
|
||
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.
strip the trailing / of the URI to increase robustness
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.
If necessary, this should be placed in normalized_uri.