@@ -7,7 +7,7 @@ pub mod tls;
77
88use authentication:: KafkaAuthentication ;
99use serde:: { Deserialize , Serialize } ;
10- use snafu:: { OptionExt , Snafu } ;
10+ use snafu:: Snafu ;
1111use stackable_operator:: {
1212 commons:: {
1313 cluster_operation:: ClusterOperation , networking:: DomainName ,
@@ -73,9 +73,6 @@ pub enum Error {
7373 ) ) ]
7474 Kafka4RequiresKraftMetadataManager ,
7575
76- #[ snafu( display( "The Kafka role [{role}] is missing from spec" ) ) ]
77- MissingRole { role : String } ,
78-
7976 #[ snafu( display(
8077 "Kafka version 4 and higher requires a Kraft controller (configured via `spec.controller`)"
8178 ) ) ]
@@ -130,7 +127,7 @@ pub mod versioned {
130127 pub image : ProductImage ,
131128
132129 // no doc - docs in Role struct.
133- pub brokers : Option < BrokerRole > ,
130+ pub brokers : BrokerRole ,
134131
135132 // no doc - docs in Role struct.
136133 pub controllers : Option < ControllerRole > ,
@@ -320,12 +317,6 @@ impl v1alpha1::KafkaCluster {
320317 _ => None ,
321318 } )
322319 }
323-
324- pub fn broker_role ( & self ) -> Result < & BrokerRole , Error > {
325- self . spec . brokers . as_ref ( ) . context ( MissingRoleSnafu {
326- role : KafkaRole :: Broker . to_string ( ) ,
327- } )
328- }
329320}
330321
331322/// Reference to a single `Pod` that is a component of a [`KafkaCluster`]
@@ -444,6 +435,10 @@ mod tests {
444435 spec:
445436 image:
446437 productVersion: 3.9.2
438+ brokers:
439+ roleGroups:
440+ default:
441+ replicas: 1
447442 clusterConfig:
448443 zookeeperConfigMapName: xyz
449444 "# ;
@@ -463,6 +458,10 @@ mod tests {
463458 spec:
464459 image:
465460 productVersion: 3.9.2
461+ brokers:
462+ roleGroups:
463+ default:
464+ replicas: 1
466465 clusterConfig:
467466 tls:
468467 serverSecretClass: simple-kafka-server-tls
@@ -488,6 +487,10 @@ mod tests {
488487 spec:
489488 image:
490489 productVersion: 3.9.2
490+ brokers:
491+ roleGroups:
492+ default:
493+ replicas: 1
491494 clusterConfig:
492495 tls:
493496 serverSecretClass: null
@@ -509,6 +512,10 @@ mod tests {
509512 spec:
510513 image:
511514 productVersion: 3.9.2
515+ brokers:
516+ roleGroups:
517+ default:
518+ replicas: 1
512519 zookeeperConfigMapName: xyz
513520 clusterConfig:
514521 tls:
@@ -534,6 +541,10 @@ mod tests {
534541 spec:
535542 image:
536543 productVersion: 3.9.2
544+ brokers:
545+ roleGroups:
546+ default:
547+ replicas: 1
537548 clusterConfig:
538549 zookeeperConfigMapName: xyz
539550 "# ;
@@ -553,6 +564,10 @@ mod tests {
553564 spec:
554565 image:
555566 productVersion: 3.9.2
567+ brokers:
568+ roleGroups:
569+ default:
570+ replicas: 1
556571 clusterConfig:
557572 tls:
558573 internalSecretClass: simple-kafka-internal-tls
@@ -574,6 +589,10 @@ mod tests {
574589 spec:
575590 image:
576591 productVersion: 3.9.2
592+ brokers:
593+ roleGroups:
594+ default:
595+ replicas: 1
577596 clusterConfig:
578597 tls:
579598 serverSecretClass: simple-kafka-server-tls
0 commit comments