@@ -20,7 +20,7 @@ use stackable_operator::{
2020 crd:: authentication:: core,
2121 k8s_openapi:: api:: core:: v1:: Volume ,
2222 shared:: time:: Duration ,
23- v2:: types:: kubernetes:: SecretClassName ,
23+ v2:: types:: { common :: Port , kubernetes:: SecretClassName } ,
2424} ;
2525
2626use super :: listener:: KafkaListenerProtocol ;
@@ -66,28 +66,28 @@ pub struct KafkaTlsSecurity {
6666}
6767
6868impl KafkaTlsSecurity {
69- pub const BOOTSTRAP_PORT : u16 = 9094 ;
69+ pub const BOOTSTRAP_PORT : Port = Port ( 9094 ) ;
7070 // bootstrap: we will have a single named port with different values for
7171 // secure (9095) and insecure (9094). The bootstrap listener is needed to
7272 // be able to expose principals for both the broker and bootstrap in the
7373 // JAAS configuration, so that clients can use both.
7474 pub const BOOTSTRAP_PORT_NAME : & ' static str = "bootstrap" ;
75- pub const CLIENT_PORT : u16 = 9092 ;
75+ pub const CLIENT_PORT : Port = Port ( 9092 ) ;
7676 // ports
7777 pub const CLIENT_PORT_NAME : & ' static str = "kafka" ;
7878 // internal
79- pub const INTERNAL_PORT : u16 = 19092 ;
79+ pub const INTERNAL_PORT : Port = Port ( 19092 ) ;
8080 // - TLS internal
8181 const INTER_BROKER_LISTENER_NAME : & ' static str = "inter.broker.listener.name" ;
8282 // - TLS global
8383 const KEYSTORE_P12_FILE_NAME : & ' static str = "keystore.p12" ;
8484 const OPA_TLS_MOUNT_PATH : & str = "/stackable/tls-opa" ;
8585 // opa
8686 const OPA_TLS_VOLUME_NAME : & str = "tls-opa" ;
87- pub const SECURE_BOOTSTRAP_PORT : u16 = 9095 ;
88- pub const SECURE_CLIENT_PORT : u16 = 9093 ;
87+ pub const SECURE_BOOTSTRAP_PORT : Port = Port ( 9095 ) ;
88+ pub const SECURE_CLIENT_PORT : Port = Port ( 9093 ) ;
8989 pub const SECURE_CLIENT_PORT_NAME : & ' static str = "kafka-tls" ;
90- pub const SECURE_INTERNAL_PORT : u16 = 19093 ;
90+ pub const SECURE_INTERNAL_PORT : Port = Port ( 19093 ) ;
9191 const SSL_STORE_PASSWORD : & ' static str = "" ;
9292 const SSL_STORE_TYPE_PKCS12 : & ' static str = "PKCS12" ;
9393 const STACKABLE_TLS_KAFKA_INTERNAL_DIR : & ' static str = "/stackable/tls-kafka-internal" ;
@@ -222,15 +222,15 @@ impl KafkaTlsSecurity {
222222 }
223223
224224 /// Return the Kafka (secure) client port depending on tls or authentication settings.
225- pub fn client_port ( & self ) -> u16 {
225+ pub fn client_port ( & self ) -> Port {
226226 if self . tls_enabled ( ) {
227227 Self :: SECURE_CLIENT_PORT
228228 } else {
229229 Self :: CLIENT_PORT
230230 }
231231 }
232232
233- pub fn bootstrap_port ( & self ) -> u16 {
233+ pub fn bootstrap_port ( & self ) -> Port {
234234 if self . tls_enabled ( ) {
235235 Self :: SECURE_BOOTSTRAP_PORT
236236 } else {
@@ -252,7 +252,7 @@ impl KafkaTlsSecurity {
252252 }
253253
254254 /// Return the Kafka (secure) internal port depending on tls settings.
255- pub fn internal_port ( & self ) -> u16 {
255+ pub fn internal_port ( & self ) -> Port {
256256 if self . tls_internal_secret_class ( ) . is_some ( ) {
257257 Self :: SECURE_INTERNAL_PORT
258258 } else {
0 commit comments