diff --git a/rust/operator-binary/src/restart_controller/statefulset.rs b/rust/operator-binary/src/restart_controller/statefulset.rs index 8e3e874..ec4ce94 100644 --- a/rust/operator-binary/src/restart_controller/statefulset.rs +++ b/rust/operator-binary/src/restart_controller/statefulset.rs @@ -10,6 +10,7 @@ use serde_json::json; use snafu::{ResultExt, Snafu}; use stackable_operator::{ client::Client, + constants::RESTART_CONTROLLER_ENABLED_LABEL, k8s_openapi::api::{ apps::v1::StatefulSet, core::v1::{ConfigMap, EnvFromSource, EnvVar, PodSpec, Secret, Volume}, @@ -190,7 +191,8 @@ pub async fn start( sts_store, watcher( stses, - watcher::Config::default().labels("restarter.stackable.tech/enabled=true"), + watcher::Config::default() + .labels(&RESTART_CONTROLLER_ENABLED_LABEL.to_string()), ), ) .applied_objects(), diff --git a/rust/operator-binary/src/webhooks/restarter_mutate_sts.rs b/rust/operator-binary/src/webhooks/restarter_mutate_sts.rs index a00548e..afa0830 100644 --- a/rust/operator-binary/src/webhooks/restarter_mutate_sts.rs +++ b/rust/operator-binary/src/webhooks/restarter_mutate_sts.rs @@ -3,6 +3,7 @@ use std::{collections::BTreeMap, ops::Not, sync::Arc}; use json_patch::{AddOperation, Patch, PatchOperation, jsonptr::PointerBuf}; use stackable_operator::{ builder::meta::ObjectMetaBuilder, + constants::RESTART_CONTROLLER_ENABLED_LABEL, k8s_openapi::{ api::{ admissionregistration::v1::{ @@ -77,8 +78,8 @@ fn get_sts_restarter_mutating_webhook_configuration() -> MutatingWebhookConfigur // label set to `true`. object_selector: Some(LabelSelector { match_labels: Some(BTreeMap::from([( - "restarter.stackable.tech/enabled".to_owned(), - "true".to_owned(), + RESTART_CONTROLLER_ENABLED_LABEL.key().to_string(), + RESTART_CONTROLLER_ENABLED_LABEL.value().to_string(), )])), match_expressions: None, }),