diff --git a/Cargo.nix b/Cargo.nix index b7cf9ecb..7a601bdd 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -9865,7 +9865,7 @@ rec { "stackable-spark-k8s-operator" = rec { crateName = "stackable-spark-k8s-operator"; version = "0.0.0-dev"; - edition = "2021"; + edition = "2024"; crateBin = [ { name = "stackable-spark-k8s-operator"; diff --git a/Cargo.toml b/Cargo.toml index 8e405087..11362c45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ resolver = "2" version = "0.0.0-dev" authors = ["Stackable GmbH "] license = "OSL-3.0" -edition = "2021" +edition = "2024" repository = "https://github.com/stackabletech/spark-k8s-operator" [workspace.dependencies] diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index e2048dea..2a383067 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -407,10 +407,10 @@ impl v1alpha1::SparkApplication { ); } - if let Some(log_dir) = logdir.as_ref() { - if let Some(volume) = log_dir.credentials_volume().context(ConfigureLogDirSnafu)? { - result.insert(volume.name.clone(), volume); - } + if let Some(log_dir) = logdir.as_ref() + && let Some(volume) = log_dir.credentials_volume().context(ConfigureLogDirSnafu)? + { + result.insert(volume.name.clone(), volume); } if let Some(log_config_map) = log_config_map { diff --git a/rust/operator-binary/src/crd/template_merger.rs b/rust/operator-binary/src/crd/template_merger.rs index 797b3d6c..667e5128 100644 --- a/rust/operator-binary/src/crd/template_merger.rs +++ b/rust/operator-binary/src/crd/template_merger.rs @@ -157,12 +157,11 @@ fn merge_pod_template_spec(base: &PodTemplateSpec, overlay: &PodTemplateSpec) -> base.spec.as_ref(), overlay.spec.as_ref(), merged.spec.as_mut(), - ) { - if let Some(overlay_node_selector) = overlay_spec.node_selector.as_ref() { - let mut node_selector = base_spec.node_selector.clone().unwrap_or_default(); - node_selector.extend(overlay_node_selector.clone()); - merged_spec.node_selector = Some(node_selector); - } + ) && let Some(overlay_node_selector) = overlay_spec.node_selector.as_ref() + { + let mut node_selector = base_spec.node_selector.clone().unwrap_or_default(); + node_selector.extend(overlay_node_selector.clone()); + merged_spec.node_selector = Some(node_selector); } merged diff --git a/rust/operator-binary/src/crd/tlscerts.rs b/rust/operator-binary/src/crd/tlscerts.rs index 64bea969..a31bda07 100644 --- a/rust/operator-binary/src/crd/tlscerts.rs +++ b/rust/operator-binary/src/crd/tlscerts.rs @@ -20,7 +20,7 @@ pub fn tls_secret_name(s3conn: &s3::v1alpha1::ConnectionSpec) -> Option<&str> { Some(Tls { verification: TlsVerification::Server(TlsServerVerification { - ca_cert: CaCert::SecretClass(ref secret_name), + ca_cert: CaCert::SecretClass(secret_name), }), }), }, @@ -44,10 +44,10 @@ pub fn tls_secret_names<'a>( names.insert(secret_name); } - if let Some(logdir) = logdir { - if let Some(secret_name) = logdir.tls_secret_name() { - names.insert(secret_name); - } + if let Some(logdir) = logdir + && let Some(secret_name) = logdir.tls_secret_name() + { + names.insert(secret_name); } if names.is_empty() { None diff --git a/rust/operator-binary/src/history/controller.rs b/rust/operator-binary/src/history/controller.rs index 957e60da..3d88a879 100644 --- a/rust/operator-binary/src/history/controller.rs +++ b/rust/operator-binary/src/history/controller.rs @@ -765,17 +765,17 @@ fn cleaner_config( } // check if cleaner is set for this rolegroup ref - if cleaner_rolegroups.len() == 1 && cleaner_rolegroups[0].role_group == rolegroup_ref.role_group + if cleaner_rolegroups.len() == 1 + && cleaner_rolegroups[0].role_group == rolegroup_ref.role_group + && let Some(replicas) = shs.replicas(rolegroup_ref) { - if let Some(replicas) = shs.replicas(rolegroup_ref) { - if replicas > 1 { - return TooManyCleanerReplicasSnafu.fail(); - } else { - result.insert( - "spark.history.fs.cleaner.enabled".to_string(), - "true".to_string(), - ); - } + if replicas > 1 { + return TooManyCleanerReplicasSnafu.fail(); + } else { + result.insert( + "spark.history.fs.cleaner.enabled".to_string(), + "true".to_string(), + ); } } diff --git a/rust/operator-binary/src/spark_k8s_controller/validate.rs b/rust/operator-binary/src/spark_k8s_controller/validate.rs index a00b15b1..ae9b6682 100644 --- a/rust/operator-binary/src/spark_k8s_controller/validate.rs +++ b/rust/operator-binary/src/spark_k8s_controller/validate.rs @@ -85,13 +85,13 @@ pub fn validate( } fn reject_tls_no_verification(conn: &s3::v1alpha1::ConnectionSpec, context: &str) -> Result<()> { - if let Some(tls) = &conn.tls.tls { - if matches!(&tls.verification, TlsVerification::None {}) { - return S3TlsNoVerificationNotSupportedSnafu { - context: context.to_owned(), - } - .fail(); + if let Some(tls) = &conn.tls.tls + && matches!(&tls.verification, TlsVerification::None {}) + { + return S3TlsNoVerificationNotSupportedSnafu { + context: context.to_owned(), } + .fail(); } Ok(()) } diff --git a/rust/operator-binary/src/webhooks/conversion.rs b/rust/operator-binary/src/webhooks/conversion.rs index f32c6fdd..2bd9d683 100644 --- a/rust/operator-binary/src/webhooks/conversion.rs +++ b/rust/operator-binary/src/webhooks/conversion.rs @@ -63,7 +63,7 @@ pub async fn create_webhook_server( field_manager: FIELD_MANAGER.to_owned(), }; - let (conversion_webhook, _initial_reconcile_rx) = + let (conversion_webhook, _) = ConversionWebhook::new(crds_and_handlers, client, conversion_webhook_options); let webhook_server_options = WebhookServerOptions {