From 12f12b48100f31080d38f1b279ca4cb4878b21fb Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Wed, 21 Jan 2026 17:27:48 +0100 Subject: [PATCH] feat: Watch all deployed resources --- rust/operator-binary/src/main.rs | 95 ++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 35 deletions(-) diff --git a/rust/operator-binary/src/main.rs b/rust/operator-binary/src/main.rs index e7df8f2..abbe1fd 100644 --- a/rust/operator-binary/src/main.rs +++ b/rust/operator-binary/src/main.rs @@ -8,8 +8,14 @@ use snafu::{ResultExt as _, Snafu}; use stackable_operator::{ YamlSchema as _, cli::{Command, RunArguments}, + crd::listener, eos::EndOfSupportChecker, - k8s_openapi::api::{apps::v1::StatefulSet, core::v1::Service}, + k8s_openapi::api::{ + apps::v1::StatefulSet, + core::v1::{ConfigMap, Service, ServiceAccount}, + policy::v1::PodDisruptionBudget, + rbac::v1::RoleBinding, + }, kube::{ core::DeserializeGuard, runtime::{ @@ -133,40 +139,59 @@ async fn main() -> Result<()> { let controller = Controller::new( watch_namespace.get_api::>(&client), watcher::Config::default(), - ); - let controller = controller - .owns( - watch_namespace.get_api::(&client), - watcher::Config::default(), - ) - .owns( - watch_namespace.get_api::(&client), - watcher::Config::default(), - ) - .shutdown_on_signal() - .run( - controller::reconcile, - controller::error_policy, - Arc::new(controller_context), - ) - .for_each_concurrent( - 16, // concurrency limit - |result| { - // The event_recorder needs to be shared across all invocations, so that - // events are correctly aggregated - let event_recorder = event_recorder.clone(); - let full_controller_name = full_controller_name.clone(); - async move { - report_controller_reconciled( - &event_recorder, - &full_controller_name, - &result, - ) - .await; - } - }, - ) - .map(Ok); + ) + .owns( + watch_namespace.get_api::>(&client), + watcher::Config::default(), + ) + .owns( + watch_namespace.get_api::>(&client), + watcher::Config::default(), + ) + .owns( + watch_namespace.get_api::>(&client), + watcher::Config::default(), + ) + .owns( + watch_namespace.get_api::>(&client), + watcher::Config::default(), + ) + .owns( + watch_namespace.get_api::>(&client), + watcher::Config::default(), + ) + .owns( + watch_namespace.get_api::>(&client), + watcher::Config::default(), + ) + .owns( + watch_namespace.get_api::>(&client), + watcher::Config::default(), + ) + .shutdown_on_signal() + .run( + controller::reconcile, + controller::error_policy, + Arc::new(controller_context), + ) + .for_each_concurrent( + 16, // concurrency limit + |result| { + // The event_recorder needs to be shared across all invocations, so that + // events are correctly aggregated + let event_recorder = event_recorder.clone(); + let full_controller_name = full_controller_name.clone(); + async move { + report_controller_reconciled( + &event_recorder, + &full_controller_name, + &result, + ) + .await; + } + }, + ) + .map(Ok); futures::try_join!(controller, eos_checker)?; }