7
7
use std:: collections:: BTreeMap ;
8
8
9
9
use indoc:: formatdoc;
10
- use snafu:: { ensure , ResultExt , Snafu } ;
10
+ use snafu:: { ResultExt , Snafu , ensure } ;
11
11
use stackable_operator:: {
12
12
builder:: {
13
13
self ,
14
14
pod:: {
15
+ PodBuilder ,
15
16
container:: ContainerBuilder ,
16
17
volume:: { SecretFormat , SecretOperatorVolumeSourceBuilder , VolumeBuilder } ,
17
- PodBuilder ,
18
18
} ,
19
19
} ,
20
20
client:: Client ,
@@ -29,11 +29,12 @@ use stackable_operator::{
29
29
30
30
use super :: listener:: node_port_cmd;
31
31
use crate :: crd:: {
32
+ KafkaRole , LISTENER_BOOTSTRAP_VOLUME_NAME , LISTENER_BROKER_VOLUME_NAME , SERVER_PROPERTIES_FILE ,
33
+ STACKABLE_CONFIG_DIR , STACKABLE_KERBEROS_KRB5_PATH , STACKABLE_LISTENER_BOOTSTRAP_DIR ,
34
+ STACKABLE_LISTENER_BROKER_DIR , STACKABLE_LOG_DIR ,
32
35
authentication:: { self , ResolvedAuthenticationClasses } ,
33
- listener:: { self , node_address_cmd, KafkaListenerConfig } ,
34
- tls, v1alpha1, KafkaRole , LISTENER_BOOTSTRAP_VOLUME_NAME , LISTENER_BROKER_VOLUME_NAME ,
35
- SERVER_PROPERTIES_FILE , STACKABLE_CONFIG_DIR , STACKABLE_KERBEROS_KRB5_PATH ,
36
- STACKABLE_LISTENER_BOOTSTRAP_DIR , STACKABLE_LISTENER_BROKER_DIR , STACKABLE_LOG_DIR ,
36
+ listener:: { self , KafkaListenerConfig , node_address_cmd} ,
37
+ tls, v1alpha1,
37
38
} ;
38
39
39
40
#[ derive( Snafu , Debug ) ]
@@ -66,32 +67,12 @@ pub struct KafkaTlsSecurity {
66
67
}
67
68
68
69
impl KafkaTlsSecurity {
69
- // ports
70
- pub const CLIENT_PORT_NAME : & ' static str = "kafka" ;
71
- pub const CLIENT_PORT : u16 = 9092 ;
72
- pub const SECURE_CLIENT_PORT_NAME : & ' static str = "kafka-tls" ;
73
- pub const SECURE_CLIENT_PORT : u16 = 9093 ;
70
+ pub const BOOTSTRAP_PORT : u16 = 9094 ;
74
71
// bootstrap: we will have a single named port with different values for
75
72
// secure (9095) and insecure (9094). The bootstrap listener is needed to
76
73
// be able to expose principals for both the broker and bootstrap in the
77
74
// JAAS configuration, so that clients can use both.
78
75
pub const BOOTSTRAP_PORT_NAME : & ' static str = "bootstrap" ;
79
- pub const BOOTSTRAP_PORT : u16 = 9094 ;
80
- pub const SECURE_BOOTSTRAP_PORT : u16 = 9095 ;
81
- // internal
82
- pub const INTERNAL_PORT : u16 = 19092 ;
83
- pub const SECURE_INTERNAL_PORT : u16 = 19093 ;
84
- // - TLS global
85
- const SSL_STORE_PASSWORD : & ' static str = "" ;
86
- // - TLS client
87
- const CLIENT_SSL_KEYSTORE_LOCATION : & ' static str = "listener.name.client.ssl.keystore.location" ;
88
- const CLIENT_SSL_KEYSTORE_PASSWORD : & ' static str = "listener.name.client.ssl.keystore.password" ;
89
- const CLIENT_SSL_KEYSTORE_TYPE : & ' static str = "listener.name.client.ssl.keystore.type" ;
90
- const CLIENT_SSL_TRUSTSTORE_LOCATION : & ' static str =
91
- "listener.name.client.ssl.truststore.location" ;
92
- const CLIENT_SSL_TRUSTSTORE_PASSWORD : & ' static str =
93
- "listener.name.client.ssl.truststore.password" ;
94
- const CLIENT_SSL_TRUSTSTORE_TYPE : & ' static str = "listener.name.client.ssl.truststore.type" ;
95
76
// - Bootstrapper
96
77
const BOOTSTRAP_SSL_KEYSTORE_LOCATION : & ' static str =
97
78
"listener.name.bootstrap.ssl.keystore.location" ;
@@ -104,6 +85,7 @@ impl KafkaTlsSecurity {
104
85
"listener.name.bootstrap.ssl.truststore.password" ;
105
86
const BOOTSTRAP_SSL_TRUSTSTORE_TYPE : & ' static str =
106
87
"listener.name.bootstrap.ssl.truststore.type" ;
88
+ const CLIENT_AUTH_SSL_CLIENT_AUTH : & ' static str = "listener.name.client_auth.ssl.client.auth" ;
107
89
// - TLS client authentication
108
90
const CLIENT_AUTH_SSL_KEYSTORE_LOCATION : & ' static str =
109
91
"listener.name.client_auth.ssl.keystore.location" ;
@@ -117,9 +99,23 @@ impl KafkaTlsSecurity {
117
99
"listener.name.client_auth.ssl.truststore.password" ;
118
100
const CLIENT_AUTH_SSL_TRUSTSTORE_TYPE : & ' static str =
119
101
"listener.name.client_auth.ssl.truststore.type" ;
120
- const CLIENT_AUTH_SSL_CLIENT_AUTH : & ' static str = "listener.name.client_auth.ssl.client.auth" ;
102
+ pub const CLIENT_PORT : u16 = 9092 ;
103
+ // ports
104
+ pub const CLIENT_PORT_NAME : & ' static str = "kafka" ;
105
+ // - TLS client
106
+ const CLIENT_SSL_KEYSTORE_LOCATION : & ' static str = "listener.name.client.ssl.keystore.location" ;
107
+ const CLIENT_SSL_KEYSTORE_PASSWORD : & ' static str = "listener.name.client.ssl.keystore.password" ;
108
+ const CLIENT_SSL_KEYSTORE_TYPE : & ' static str = "listener.name.client.ssl.keystore.type" ;
109
+ const CLIENT_SSL_TRUSTSTORE_LOCATION : & ' static str =
110
+ "listener.name.client.ssl.truststore.location" ;
111
+ const CLIENT_SSL_TRUSTSTORE_PASSWORD : & ' static str =
112
+ "listener.name.client.ssl.truststore.password" ;
113
+ const CLIENT_SSL_TRUSTSTORE_TYPE : & ' static str = "listener.name.client.ssl.truststore.type" ;
114
+ // internal
115
+ pub const INTERNAL_PORT : u16 = 19092 ;
121
116
// - TLS internal
122
117
const INTER_BROKER_LISTENER_NAME : & ' static str = "inter.broker.listener.name" ;
118
+ const INTER_SSL_CLIENT_AUTH : & ' static str = "listener.name.internal.ssl.client.auth" ;
123
119
const INTER_SSL_KEYSTORE_LOCATION : & ' static str =
124
120
"listener.name.internal.ssl.keystore.location" ;
125
121
const INTER_SSL_KEYSTORE_PASSWORD : & ' static str =
@@ -130,14 +126,19 @@ impl KafkaTlsSecurity {
130
126
const INTER_SSL_TRUSTSTORE_PASSWORD : & ' static str =
131
127
"listener.name.internal.ssl.truststore.password" ;
132
128
const INTER_SSL_TRUSTSTORE_TYPE : & ' static str = "listener.name.internal.ssl.truststore.type" ;
133
- const INTER_SSL_CLIENT_AUTH : & ' static str = "listener.name.internal.ssl.client.auth" ;
129
+ pub const SECURE_BOOTSTRAP_PORT : u16 = 9095 ;
130
+ pub const SECURE_CLIENT_PORT : u16 = 9093 ;
131
+ pub const SECURE_CLIENT_PORT_NAME : & ' static str = "kafka-tls" ;
132
+ pub const SECURE_INTERNAL_PORT : u16 = 19093 ;
133
+ // - TLS global
134
+ const SSL_STORE_PASSWORD : & ' static str = "" ;
135
+ const STACKABLE_TLS_KAFKA_INTERNAL_DIR : & ' static str = "/stackable/tls-kafka-internal" ;
136
+ const STACKABLE_TLS_KAFKA_INTERNAL_VOLUME_NAME : & ' static str = "tls-kafka-internal" ;
137
+ const STACKABLE_TLS_KAFKA_SERVER_DIR : & ' static str = "/stackable/tls-kafka-server" ;
138
+ const STACKABLE_TLS_KAFKA_SERVER_VOLUME_NAME : & ' static str = "tls-kafka-server" ;
134
139
// directories
135
140
const STACKABLE_TLS_KCAT_DIR : & ' static str = "/stackable/tls-kcat" ;
136
141
const STACKABLE_TLS_KCAT_VOLUME_NAME : & ' static str = "tls-kcat" ;
137
- const STACKABLE_TLS_KAFKA_SERVER_DIR : & ' static str = "/stackable/tls-kafka-server" ;
138
- const STACKABLE_TLS_KAFKA_SERVER_VOLUME_NAME : & ' static str = "tls-kafka-server" ;
139
- const STACKABLE_TLS_KAFKA_INTERNAL_DIR : & ' static str = "/stackable/tls-kafka-internal" ;
140
- const STACKABLE_TLS_KAFKA_INTERNAL_VOLUME_NAME : & ' static str = "tls-kafka-internal" ;
141
142
142
143
#[ cfg( test) ]
143
144
pub fn new (
@@ -685,7 +686,9 @@ impl KafkaTlsSecurity {
685
686
"-X" . to_string( ) ,
686
687
format!( "sasl.kerberos.service.name={service_name}" ) ,
687
688
"-X" . to_string( ) ,
688
- format!( "sasl.kerberos.principal={service_name}/$POD_BROKER_LISTENER_ADDRESS@$KERBEROS_REALM" ) ,
689
+ format!(
690
+ "sasl.kerberos.principal={service_name}/$POD_BROKER_LISTENER_ADDRESS@$KERBEROS_REALM"
691
+ ) ,
689
692
]
690
693
}
691
694
}
0 commit comments