@@ -6,6 +6,7 @@ use stackable_operator::{
66 kube:: Client ,
77 webhook:: { WebhookServer , WebhookServerError , WebhookServerOptions , webhooks:: Webhook } ,
88} ;
9+ use tokio:: sync:: oneshot;
910
1011use crate :: restart_controller:: statefulset:: Ctx ;
1112
@@ -24,7 +25,7 @@ pub async fn create_webhook_server(
2425 disable_restarter_mutating_webhook : bool ,
2526 disable_crd_maintenance : bool ,
2627 client : Client ,
27- ) -> Result < WebhookServer , Error > {
28+ ) -> Result < ( WebhookServer , oneshot :: Receiver < ( ) > ) , Error > {
2829 let mut webhooks: Vec < Box < dyn Webhook > > = vec ! [ ] ;
2930
3031 if let Some ( webhook) = restarter_mutate_sts:: create_webhook (
@@ -37,14 +38,19 @@ pub async fn create_webhook_server(
3738
3839 // TODO (@Techassi): The conversion webhook should also allow to be disabled, rework the
3940 // granularity of these options.
40- webhooks. push ( conversion:: create_webhook ( disable_crd_maintenance, client) ) ;
41+ let ( webhook, initial_reconcile_rx) =
42+ conversion:: create_webhook ( disable_crd_maintenance, client) ;
43+ webhooks. push ( webhook) ;
4144
4245 let webhook_options = WebhookServerOptions {
4346 socket_addr : WebhookServer :: DEFAULT_SOCKET_ADDRESS ,
4447 webhook_namespace : operator_environment. operator_namespace . to_owned ( ) ,
4548 webhook_service_name : operator_environment. operator_service_name . to_owned ( ) ,
4649 } ;
47- WebhookServer :: new ( webhooks, webhook_options)
50+
51+ let webhook_server = WebhookServer :: new ( webhooks, webhook_options)
4852 . await
49- . context ( CreateWebhookServerSnafu )
53+ . context ( CreateWebhookServerSnafu ) ?;
54+
55+ Ok ( ( webhook_server, initial_reconcile_rx) )
5056}
0 commit comments