Skip to content

Commit b4fd4dc

Browse files
committed
fix: remove obsolete errors, dead enum variant, tighten visibility of constants
1 parent 241284e commit b4fd4dc

5 files changed

Lines changed: 10 additions & 34 deletions

File tree

rust/operator-binary/src/controller.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mod validate;
3535

3636
use crate::{
3737
crd::{
38-
self, APP_NAME, KafkaClusterStatus, KafkaPodDescriptor, MetadataManager, OPERATOR_NAME,
38+
APP_NAME, KafkaClusterStatus, KafkaPodDescriptor, MetadataManager, OPERATOR_NAME,
3939
authorization::KafkaAuthorizationConfig,
4040
listener::get_kafka_listener_config,
4141
role::{AnyConfig, AnyConfigOverrides, KafkaRole},
@@ -73,8 +73,8 @@ pub enum Error {
7373
source: crate::crd::listener::KafkaListenerError,
7474
},
7575

76-
#[snafu(display("failed to apply role Service"))]
77-
ApplyRoleService {
76+
#[snafu(display("failed to apply bootstrap Listener"))]
77+
ApplyBootstrapListener {
7878
source: stackable_operator::cluster_resources::Error,
7979
},
8080

@@ -150,9 +150,6 @@ pub enum Error {
150150
source: error_boundary::InvalidObject,
151151
},
152152

153-
#[snafu(display("KafkaCluster object is misconfigured"))]
154-
MisconfiguredKafkaCluster { source: crd::Error },
155-
156153
#[snafu(display("failed to build statefulset"))]
157154
BuildStatefulset {
158155
source: crate::resource::statefulset::Error,
@@ -184,7 +181,7 @@ impl ReconcilerError for Error {
184181
match self {
185182
Error::Dereference { .. } => None,
186183
Error::ValidateCluster { .. } => None,
187-
Error::ApplyRoleService { .. } => None,
184+
Error::ApplyBootstrapListener { .. } => None,
188185
Error::ApplyRoleGroupService { .. } => None,
189186
Error::ApplyRoleGroupConfig { .. } => None,
190187
Error::ApplyRoleGroupStatefulSet { .. } => None,
@@ -199,7 +196,6 @@ impl ReconcilerError for Error {
199196
Error::FailedToCreatePdb { .. } => None,
200197
Error::GetRequiredLabels { .. } => None,
201198
Error::InvalidKafkaCluster { .. } => None,
202-
Error::MisconfiguredKafkaCluster { .. } => None,
203199
Error::BuildStatefulset { .. } => None,
204200
Error::BuildConfigMap { .. } => None,
205201
Error::BuildService { .. } => None,
@@ -444,7 +440,7 @@ pub async fn reconcile_kafka(
444440
cluster_resources
445441
.add(client, rg_bootstrap_listener)
446442
.await
447-
.context(ApplyRoleServiceSnafu)?,
443+
.context(ApplyBootstrapListenerSnafu)?,
448444
);
449445
}
450446

rust/operator-binary/src/controller/build/config_map.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ use crate::{
2222

2323
#[derive(Snafu, Debug)]
2424
pub enum Error {
25-
#[snafu(display("invalid metadata manager"))]
26-
InvalidMetadataManager { source: crate::crd::Error },
27-
2825
#[snafu(display("failed to build ConfigMap for {}", rolegroup))]
2926
BuildRoleGroupConfig {
3027
source: stackable_operator::builder::configmap::Error,
@@ -56,12 +53,6 @@ pub enum Error {
5653
rolegroup: RoleGroupRef<v1alpha1::KafkaCluster>,
5754
},
5855

59-
#[snafu(display("failed to build jaas configuration file for {rolegroup}"))]
60-
BuildJaasConfig { rolegroup: String },
61-
62-
#[snafu(display("failed to build pod descriptors"))]
63-
BuildPodDescriptors { source: crate::crd::Error },
64-
6556
#[snafu(display("no Kraft controllers found to build"))]
6657
NoKraftControllersFound,
6758
}

rust/operator-binary/src/crd/role/broker.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ pub const BROKER_PROPERTIES_FILE: &str = "broker.properties";
3333
pub enum BrokerContainer {
3434
Vector,
3535
KcatProber,
36-
GetService,
3736
Kafka,
3837
}
3938

rust/operator-binary/src/product_logging.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ pub const BROKER_ID_POD_MAP_DIR: &str = "/stackable/broker-id-pod-map";
1818
pub const STACKABLE_LOG_CONFIG_DIR: &str = "/stackable/log_config";
1919
pub const STACKABLE_LOG_DIR: &str = "/stackable/log";
2020
// log4j
21-
pub const LOG4J_CONFIG_FILE: &str = "log4j.properties";
22-
pub const KAFKA_LOG4J_FILE: &str = "kafka.log4j.xml";
21+
const LOG4J_CONFIG_FILE: &str = "log4j.properties";
22+
const KAFKA_LOG4J_FILE: &str = "kafka.log4j.xml";
2323
// log4j2
24-
pub const LOG4J2_CONFIG_FILE: &str = "log4j2.properties";
25-
pub const KAFKA_LOG4J2_FILE: &str = "kafka.log4j2.xml";
24+
const LOG4J2_CONFIG_FILE: &str = "log4j2.properties";
25+
const KAFKA_LOG4J2_FILE: &str = "kafka.log4j2.xml";
2626
// max size
2727
pub const MAX_KAFKA_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity {
2828
value: 10.0,

rust/operator-binary/src/resource/statefulset.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@ pub enum Error {
118118
source: stackable_operator::builder::pod::container::Error,
119119
},
120120

121-
#[snafu(display("invalid kafka listeners"))]
122-
InvalidKafkaListeners {
123-
source: crate::crd::listener::KafkaListenerError,
124-
},
125-
126121
#[snafu(display("failed to build Labels"))]
127122
LabelBuild {
128123
source: stackable_operator::kvp::LabelError,
@@ -147,19 +142,14 @@ pub enum Error {
147142
#[snafu(display("failed to retrieve rolegroup replicas"))]
148143
RoleGroupReplicas { source: crd::role::Error },
149144

150-
#[snafu(display(
151-
"cluster does not define 'metadata.name' which is required for the Kafka cluster id"
152-
))]
153-
ClusterIdMissing,
154-
155145
#[snafu(display("vector agent is enabled but vector aggregator ConfigMap is missing"))]
156146
VectorAggregatorConfigMapMissing,
157147
}
158148

159149
/// The broker rolegroup [`StatefulSet`] runs the rolegroup, as configured by the administrator.
160150
///
161151
/// The [`Pod`](`stackable_operator::k8s_openapi::api::core::v1::Pod`)s are accessible through the corresponding
162-
/// [`Service`](`stackable_operator::k8s_openapi::api::core::v1::Service`) from [`build_rolegroup_service`](`crate::resource::service::build_rolegroup_headless_service`).
152+
/// [`Service`](`stackable_operator::k8s_openapi::api::core::v1::Service`) from [`build_rolegroup_headless_service`](`crate::resource::service::build_rolegroup_headless_service`).
163153
pub fn build_broker_rolegroup_statefulset(
164154
kafka: &v1alpha1::KafkaCluster,
165155
kafka_role: &KafkaRole,

0 commit comments

Comments
 (0)