@@ -130,6 +130,7 @@ func main() {
130130 initOpsManagerImageVersion := env .ReadOrDefault (util .InitOpsManagerVersion , "latest" )
131131 // Namespace where the operator is installed
132132 currentNamespace := env .ReadOrPanic (util .CurrentNamespace )
133+ webhookSVCSelector := env .ReadOrPanic (util .OperatorNameEnv )
133134
134135 enableClusterMongoDBRoles := slices .Contains (crds , clusterMongoDBRoleCRDPlural )
135136
@@ -163,7 +164,7 @@ func main() {
163164 managerOptions .HealthProbeBindAddress = "127.0.0.1:8181"
164165 }
165166
166- webhookOptions := setupWebhook (ctx , cfg , log , slices . Contains ( crds , mongoDBMultiClusterCRDPlural ) , currentNamespace )
167+ webhookOptions := setupWebhook (ctx , cfg , log , webhookSVCSelector , currentNamespace )
167168 managerOptions .WebhookServer = crWebhook .NewServer (webhookOptions )
168169
169170 mgr , err := ctrl .NewManager (cfg , managerOptions )
@@ -393,7 +394,7 @@ func isInLocalMode() bool {
393394
394395// setupWebhook sets up the validation webhook for MongoDB resources in order
395396// to give people early warning when their MongoDB resources are wrong.
396- func setupWebhook (ctx context.Context , cfg * rest.Config , log * zap.SugaredLogger , multiClusterMode bool , currentNamespace string ) crWebhook.Options {
397+ func setupWebhook (ctx context.Context , cfg * rest.Config , log * zap.SugaredLogger , svcSelector string , currentNamespace string ) crWebhook.Options {
397398 // set webhook port — 1993 is chosen as Ben's birthday
398399 webhookPort := env .ReadIntOrDefault (util .MdbWebhookPortEnv , 1993 )
399400
@@ -419,7 +420,7 @@ func setupWebhook(ctx context.Context, cfg *rest.Config, log *zap.SugaredLogger,
419420 Namespace : currentNamespace ,
420421 }
421422
422- if err := webhook .Setup (ctx , webhookClient , webhookServiceLocation , certDir , webhookPort , multiClusterMode , log ); err != nil {
423+ if err := webhook .Setup (ctx , webhookClient , webhookServiceLocation , certDir , webhookPort , svcSelector , log ); err != nil {
423424 log .Errorf ("could not set up webhook: %v" , err )
424425 }
425426
0 commit comments