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

fix(query): add tls config for udf client #16782

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/query/expression/src/utils/udf_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use tonic::metadata::MetadataKey;
use tonic::metadata::MetadataMap;
use tonic::metadata::MetadataValue;
use tonic::transport::channel::Channel;
use tonic::transport::ClientTlsConfig;
use tonic::transport::Endpoint;
use tonic::Request;

Expand Down Expand Up @@ -65,6 +66,7 @@ impl UDFFlightClient {
request_timeout: u64,
batch_rows: u64,
) -> Result<UDFFlightClient> {
let tls_config = ClientTlsConfig::new().with_native_roots();
let endpoint = Endpoint::from_shared(addr.to_string())
.map_err(|err| {
ErrorCode::UDFServerConnectError(format!("Invalid UDF Server address: {err}"))
Expand All @@ -78,7 +80,11 @@ impl UDFFlightClient {
.tcp_keepalive(Some(Duration::from_secs(UDF_TCP_KEEP_ALIVE_SEC)))
.http2_keep_alive_interval(Duration::from_secs(UDF_HTTP2_KEEP_ALIVE_INTERVAL_SEC))
.keep_alive_timeout(Duration::from_secs(UDF_KEEP_ALIVE_TIMEOUT_SEC))
.keep_alive_while_idle(true);
.keep_alive_while_idle(true)
.tls_config(tls_config)
.map_err(|err| {
ErrorCode::UDFServerConnectError(format!("Invalid UDF Client TLS Config: {err}"))
})?;

let mut connector = HttpConnector::new_with_resolver(DNSService);
connector.enforce_http(false);
Expand Down
Loading