Skip to content

Commit bb56f16

Browse files
authored
fix(query): add tls config for udf client (#16782)
1 parent 4f987ba commit bb56f16

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/query/expression/src/utils/udf_client.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ use tonic::metadata::MetadataKey;
3737
use tonic::metadata::MetadataMap;
3838
use tonic::metadata::MetadataValue;
3939
use tonic::transport::channel::Channel;
40+
use tonic::transport::ClientTlsConfig;
4041
use tonic::transport::Endpoint;
4142
use tonic::Request;
4243

@@ -65,6 +66,7 @@ impl UDFFlightClient {
6566
request_timeout: u64,
6667
batch_rows: u64,
6768
) -> Result<UDFFlightClient> {
69+
let tls_config = ClientTlsConfig::new().with_native_roots();
6870
let endpoint = Endpoint::from_shared(addr.to_string())
6971
.map_err(|err| {
7072
ErrorCode::UDFServerConnectError(format!("Invalid UDF Server address: {err}"))
@@ -78,7 +80,11 @@ impl UDFFlightClient {
7880
.tcp_keepalive(Some(Duration::from_secs(UDF_TCP_KEEP_ALIVE_SEC)))
7981
.http2_keep_alive_interval(Duration::from_secs(UDF_HTTP2_KEEP_ALIVE_INTERVAL_SEC))
8082
.keep_alive_timeout(Duration::from_secs(UDF_KEEP_ALIVE_TIMEOUT_SEC))
81-
.keep_alive_while_idle(true);
83+
.keep_alive_while_idle(true)
84+
.tls_config(tls_config)
85+
.map_err(|err| {
86+
ErrorCode::UDFServerConnectError(format!("Invalid UDF Client TLS Config: {err}"))
87+
})?;
8288

8389
let mut connector = HttpConnector::new_with_resolver(DNSService);
8490
connector.enforce_http(false);

0 commit comments

Comments
 (0)