Skip to content

Commit 3a15769

Browse files
committed
make internal secret class name non-optional
1 parent 118feeb commit 3a15769

6 files changed

Lines changed: 172 additions & 177 deletions

File tree

rust/operator-binary/src/controller/build/properties/listener.rs

Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -99,44 +99,20 @@ pub fn get_kafka_listener_config(
9999
}
100100

101101
// INTERNAL / CONTROLLER
102-
if kafka_security.has_kerberos_enabled() || kafka_security.tls_internal_secret_class().is_some()
103-
{
104-
// 5) & 6) Kerberos and TLS authentication classes are mutually exclusive but both require internal tls to be used
105-
listeners.push(KafkaListener {
106-
name: KafkaListenerName::Internal,
107-
host: LISTENER_LOCAL_ADDRESS.to_string(),
108-
port: ValidatedKafkaSecurity::SECURE_INTERNAL_PORT.to_string(),
109-
});
110-
advertised_listeners.push(KafkaListener {
111-
name: KafkaListenerName::Internal,
112-
host: pod_fqdn.to_string(),
113-
port: ValidatedKafkaSecurity::SECURE_INTERNAL_PORT.to_string(),
114-
});
115-
listener_security_protocol_map
116-
.insert(KafkaListenerName::Internal, KafkaListenerProtocol::Ssl);
117-
listener_security_protocol_map
118-
.insert(KafkaListenerName::Controller, KafkaListenerProtocol::Ssl);
119-
} else {
120-
// 7) If no internal tls is required we expose INTERNAL as PLAINTEXT
121-
listeners.push(KafkaListener {
122-
name: KafkaListenerName::Internal,
123-
host: LISTENER_LOCAL_ADDRESS.to_string(),
124-
port: kafka_security.internal_port().to_string(),
125-
});
126-
advertised_listeners.push(KafkaListener {
127-
name: KafkaListenerName::Internal,
128-
host: pod_fqdn.to_string(),
129-
port: kafka_security.internal_port().to_string(),
130-
});
131-
listener_security_protocol_map.insert(
132-
KafkaListenerName::Internal,
133-
KafkaListenerProtocol::Plaintext,
134-
);
135-
listener_security_protocol_map.insert(
136-
KafkaListenerName::Controller,
137-
KafkaListenerProtocol::Plaintext,
138-
);
139-
}
102+
// 5) & 6) Kerberos and TLS authentication classes are mutually exclusive but both require internal tls to be used
103+
listeners.push(KafkaListener {
104+
name: KafkaListenerName::Internal,
105+
host: LISTENER_LOCAL_ADDRESS.to_string(),
106+
port: kafka_security.internal_port().to_string(),
107+
});
108+
advertised_listeners.push(KafkaListener {
109+
name: KafkaListenerName::Internal,
110+
host: pod_fqdn.to_string(),
111+
port: kafka_security.internal_port().to_string(),
112+
});
113+
listener_security_protocol_map.insert(KafkaListenerName::Internal, KafkaListenerProtocol::Ssl);
114+
listener_security_protocol_map
115+
.insert(KafkaListenerName::Controller, KafkaListenerProtocol::Ssl);
140116

141117
// BOOTSTRAP
142118
if kafka_security.has_kerberos_enabled() {
@@ -230,7 +206,7 @@ mod tests {
230206
),
231207
},
232208
}]),
233-
Some("internal-tls".parse().unwrap()),
209+
"internal-tls".parse().unwrap(),
234210
Some("tls".parse().unwrap()),
235211
None,
236212
);
@@ -295,7 +271,7 @@ mod tests {
295271

296272
let kafka_security = ValidatedKafkaSecurity::new(
297273
ResolvedAuthenticationClasses::new(vec![]),
298-
Some("tls".parse().unwrap()),
274+
"tls".parse().unwrap(),
299275
Some("tls".parse().unwrap()),
300276
None,
301277
);
@@ -358,7 +334,7 @@ mod tests {
358334

359335
let kafka_security = ValidatedKafkaSecurity::new(
360336
ResolvedAuthenticationClasses::new(vec![]),
361-
None,
337+
"tls".parse().unwrap(),
362338
None,
363339
None,
364340
);
@@ -414,9 +390,9 @@ mod tests {
414390
name = KafkaListenerName::Client,
415391
protocol = KafkaListenerProtocol::Plaintext,
416392
internal_name = KafkaListenerName::Internal,
417-
internal_protocol = KafkaListenerProtocol::Plaintext,
393+
internal_protocol = KafkaListenerProtocol::Ssl,
418394
controller_name = KafkaListenerName::Controller,
419-
controller_protocol = KafkaListenerProtocol::Plaintext,
395+
controller_protocol = KafkaListenerProtocol::Ssl,
420396
)
421397
);
422398
}
@@ -455,7 +431,7 @@ mod tests {
455431
),
456432
},
457433
}]),
458-
Some("tls".parse().unwrap()),
434+
"tls".parse().unwrap(),
459435
Some("tls".parse().unwrap()),
460436
None,
461437
);

0 commit comments

Comments
 (0)