Skip to content

Commit af70904

Browse files
committed
implement review feedback
1 parent e51050d commit af70904

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

rust/operator-binary/src/crd/security.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use stackable_operator::{
2222
shared::time::Duration,
2323
};
2424

25-
use super::listener::node_port_cmd;
25+
use super::listener::{KafkaListenerProtocol, node_port_cmd};
2626
use crate::crd::{
2727
LISTENER_BOOTSTRAP_VOLUME_NAME, LISTENER_BROKER_VOLUME_NAME, STACKABLE_KERBEROS_KRB5_PATH,
2828
STACKABLE_LISTENER_BROKER_DIR,
@@ -305,7 +305,10 @@ impl KafkaTlsSecurity {
305305
let mut props = vec![];
306306

307307
if self.tls_client_authentication_class().is_some() {
308-
props.push(("security.protocol".to_string(), Some("SSL".to_string())));
308+
props.push((
309+
"security.protocol".to_string(),
310+
Some(KafkaListenerProtocol::Ssl.to_string()),
311+
));
309312
props.push(("ssl.client.auth".to_string(), Some("required".to_string())));
310313
props.push(("ssl.keystore.type".to_string(), Some("PKCS12".to_string())));
311314
props.push((
@@ -342,7 +345,7 @@ impl KafkaTlsSecurity {
342345
// It will also make the jaas files reusable by the Kafka shell scripts.
343346
props.push((
344347
"security.protocol".to_string(),
345-
Some("SASL_SSL".to_string()),
348+
Some(KafkaListenerProtocol::SaslSsl.to_string()),
346349
));
347350
props.push(("ssl.keystore.type".to_string(), Some("PKCS12".to_string())));
348351
props.push((
@@ -391,7 +394,10 @@ impl KafkaTlsSecurity {
391394
pod="todo",
392395
realm="$KERBEROS_REALM"))));
393396
} else if self.tls_server_secret_class().is_some() {
394-
props.push(("security.protocol".to_string(), Some("SSL".to_string())));
397+
props.push((
398+
"security.protocol".to_string(),
399+
Some(KafkaListenerProtocol::Ssl.to_string()),
400+
));
395401
props.push((
396402
"ssl.truststore.type".to_string(),
397403
Some("PKCS12".to_string()),
@@ -408,11 +414,10 @@ impl KafkaTlsSecurity {
408414
Some(Self::SSL_STORE_PASSWORD.to_string()),
409415
));
410416
} else {
411-
// Empty client.properties.
412-
// Unfortunately cannot add comments because the properties writer escapes them
413-
// generating garbage.
414-
//
415-
// props.push(("# No SSL required to connect to Kafka".to_string(), None));
417+
props.push((
418+
"security.protocol".to_string(),
419+
Some(KafkaListenerProtocol::Plaintext.to_string()),
420+
));
416421
}
417422

418423
props

0 commit comments

Comments
 (0)