@@ -30,6 +30,7 @@ use stackable_operator::{
3030 logging:: controller:: report_controller_reconciled,
3131 shared:: yaml:: SerializeOptions ,
3232 telemetry:: Tracing ,
33+ utils:: signal:: SignalWatcher ,
3334} ;
3435
3536use crate :: {
@@ -99,9 +100,13 @@ async fn main() -> anyhow::Result<()> {
99100 description = built_info:: PKG_DESCRIPTION
100101 ) ;
101102
103+ // Watches for the SIGTERM signal and sends a signal to all receivers, which gracefully
104+ // shuts down all concurrent tasks below (EoS checker, controller).
105+ let sigterm_watcher = SignalWatcher :: sigterm ( ) ?;
106+
102107 let eos_checker =
103108 EndOfSupportChecker :: new ( built_info:: BUILT_TIME_UTC , maintenance. end_of_support ) ?
104- . run ( )
109+ . run ( sigterm_watcher . handle ( ) )
105110 . map ( anyhow:: Ok ) ;
106111
107112 let product_config = product_config. load ( & [
@@ -150,7 +155,6 @@ async fn main() -> anyhow::Result<()> {
150155 watch_namespace. get_api :: < RoleBinding > ( & client) ,
151156 watcher:: Config :: default ( ) ,
152157 )
153- . shutdown_on_signal ( )
154158 . watches (
155159 watch_namespace. get_api :: < DeserializeGuard < ConfigMap > > ( & client) ,
156160 watcher:: Config :: default ( ) ,
@@ -162,6 +166,7 @@ async fn main() -> anyhow::Result<()> {
162166 . map ( |kafka| ObjectRef :: from_obj ( & * kafka) )
163167 } ,
164168 )
169+ . graceful_shutdown_on ( sigterm_watcher. handle ( ) )
165170 . run (
166171 kafka_controller:: reconcile_kafka,
167172 kafka_controller:: error_policy,
0 commit comments