@@ -24,10 +24,13 @@ use stackable_operator::{
2424 versioned:: versioned,
2525} ;
2626
27- use crate :: crd:: {
28- authorization:: KafkaAuthorization ,
29- role:: { KafkaRole , broker:: BrokerConfigFragment , controller:: ControllerConfigFragment } ,
30- tls:: KafkaTls ,
27+ use crate :: {
28+ config:: node_id_hasher:: node_id_hash32_offset,
29+ crd:: {
30+ authorization:: KafkaAuthorization ,
31+ role:: { KafkaRole , broker:: BrokerConfigFragment , controller:: ControllerConfigFragment } ,
32+ tls:: KafkaTls ,
33+ } ,
3134} ;
3235
3336pub const DOCKER_IMAGE_BASE_NAME : & str = "kafka" ;
@@ -255,6 +258,7 @@ impl v1alpha1::KafkaCluster {
255258 role_group_service_name : rolegroup_ref. object_name ( ) ,
256259 replica : i,
257260 cluster_domain : cluster_info. cluster_domain . clone ( ) ,
261+ node_id : node_id_hash32_offset ( rolegroup_name) + u32:: from ( i) ,
258262 } )
259263 } )
260264 . collect ( ) ,
@@ -275,6 +279,7 @@ impl v1alpha1::KafkaCluster {
275279 role_group_service_name : rolegroup_ref. object_name ( ) ,
276280 replica : i,
277281 cluster_domain : cluster_info. cluster_domain . clone ( ) ,
282+ node_id : node_id_hash32_offset ( rolegroup_name) + u32:: from ( i) ,
278283 } )
279284 } )
280285 . collect ( ) ,
@@ -291,6 +296,7 @@ pub struct KafkaPodDescriptor {
291296 role_group_service_name : String ,
292297 replica : u16 ,
293298 cluster_domain : DomainName ,
299+ node_id : u32 ,
294300}
295301
296302impl KafkaPodDescriptor {
@@ -332,16 +338,16 @@ impl KafkaPodDescriptor {
332338 // TODO(@maltesander): Even though the used Uuid states to be type 4 it does not work... 0000000000-00000000000 works...
333339 pub fn as_voter ( & self , port : u16 ) -> String {
334340 format ! (
335- "{replica }@{fqdn}:{port}:0000000000-{replica :0>11}" ,
336- replica = self . replica ,
341+ "{node_id }@{fqdn}:{port}:0000000000-{node_id :0>11}" ,
342+ node_id = self . node_id ,
337343 fqdn = self . fqdn( ) ,
338344 )
339345 }
340346
341347 pub fn as_quorum_voter ( & self , port : u16 ) -> String {
342348 format ! (
343- "{replica }@{fqdn}:{port}" ,
344- replica = self . replica ,
349+ "{node_id }@{fqdn}:{port}" ,
350+ node_id = self . node_id ,
345351 fqdn = self . fqdn( ) ,
346352 )
347353 }
0 commit comments