From 0e7701b45930e3af5adeba556c6bda686e7c70a0 Mon Sep 17 00:00:00 2001 From: WenyXu Date: Fri, 9 Aug 2024 03:25:54 +0000 Subject: [PATCH] feat: add SASL and TLS config --- src/common/wal/src/config/kafka/datanode.rs | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/common/wal/src/config/kafka/datanode.rs b/src/common/wal/src/config/kafka/datanode.rs index b01e0635f637..4146bc29d0ff 100644 --- a/src/common/wal/src/config/kafka/datanode.rs +++ b/src/common/wal/src/config/kafka/datanode.rs @@ -39,6 +39,29 @@ pub struct DatanodeKafkaConfig { /// The kafka topic config. #[serde(flatten)] pub kafka_topic: KafkaTopicConfig, + /// Client SASL. + pub sasl: Option, + /// Client TLS config + pub tls: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +pub struct KafkaClientSasl { + #[serde(flatten)] + pub config: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(tag = "type")] +pub enum KafkaClientSaslConfig { + Plain { username: String, password: String }, +} + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +pub struct KafkaClientTls { + server_ca_cert_path: String, + client_cert_path: String, + client_key_path: String, } impl Default for DatanodeKafkaConfig { @@ -50,6 +73,8 @@ impl Default for DatanodeKafkaConfig { consumer_wait_timeout: Duration::from_millis(100), backoff: BackoffConfig::default(), kafka_topic: KafkaTopicConfig::default(), + sasl: None, + tls: None, } } }