22// This will need changes in our and upstream error types.
33#![ allow( clippy:: result_large_err) ]
44
5- mod command;
6- mod config;
7- mod controller;
8- mod crd;
9- mod discovery;
10- mod kerberos;
11- mod listener;
12- mod operations;
13- mod product_logging;
14- mod service;
15-
165use std:: sync:: Arc ;
176
7+ use anyhow:: anyhow;
188use clap:: Parser ;
19- use futures:: { FutureExt , StreamExt } ;
9+ use futures:: { FutureExt , StreamExt , TryFutureExt } ;
2010use stackable_operator:: {
2111 YamlSchema ,
2212 cli:: { Command , RunArguments } ,
@@ -44,8 +34,21 @@ use stackable_operator::{
4434use crate :: {
4535 controller:: HIVE_FULL_CONTROLLER_NAME ,
4636 crd:: { HiveCluster , HiveClusterVersion , v1alpha1} ,
37+ webhooks:: conversion:: create_webhook_server,
4738} ;
4839
40+ mod command;
41+ mod config;
42+ mod controller;
43+ mod crd;
44+ mod discovery;
45+ mod kerberos;
46+ mod listener;
47+ mod operations;
48+ mod product_logging;
49+ mod service;
50+ mod webhooks;
51+
4952mod built_info {
5053 include ! ( concat!( env!( "OUT_DIR" ) , "/built.rs" ) ) ;
5154}
@@ -66,7 +69,7 @@ async fn main() -> anyhow::Result<()> {
6669 Command :: Crd => HiveCluster :: merged_crd ( HiveClusterVersion :: V1Alpha1 ) ?
6770 . print_yaml_schema ( built_info:: PKG_VERSION , SerializeOptions :: default ( ) ) ?,
6871 Command :: Run ( RunArguments {
69- operator_environment : _ ,
72+ operator_environment,
7073 watch_namespace,
7174 product_config,
7275 maintenance,
@@ -98,16 +101,28 @@ async fn main() -> anyhow::Result<()> {
98101 . run ( sigterm_watcher. handle ( ) )
99102 . map ( anyhow:: Ok ) ;
100103
101- let product_config = product_config. load ( & [
102- "deploy/config-spec/properties.yaml" ,
103- "/etc/stackable/hive-operator/config-spec/properties.yaml" ,
104- ] ) ?;
105-
106104 let client = stackable_operator:: client:: initialize_operator (
107105 Some ( OPERATOR_NAME . to_string ( ) ) ,
108106 & common. cluster_info ,
109107 )
110108 . await ?;
109+
110+ let webhook_server = create_webhook_server (
111+ & operator_environment,
112+ maintenance. disable_crd_maintenance ,
113+ client. as_kube_client ( ) ,
114+ )
115+ . await ?;
116+
117+ let webhook_server = webhook_server
118+ . run ( sigterm_watcher. handle ( ) )
119+ . map_err ( |err| anyhow ! ( err) . context ( "failed to run webhook server" ) ) ;
120+
121+ let product_config = product_config. load ( & [
122+ "deploy/config-spec/properties.yaml" ,
123+ "/etc/stackable/hive-operator/config-spec/properties.yaml" ,
124+ ] ) ?;
125+
111126 let event_recorder = Arc :: new ( Recorder :: new (
112127 client. as_kube_client ( ) ,
113128 Reporter {
@@ -173,7 +188,7 @@ async fn main() -> anyhow::Result<()> {
173188 )
174189 . map ( anyhow:: Ok ) ;
175190
176- futures:: try_join!( hive_controller, eos_checker) ?;
191+ futures:: try_join!( hive_controller, eos_checker, webhook_server ) ?;
177192 }
178193 }
179194
0 commit comments