@@ -130,6 +130,7 @@ func main() {
130
130
initOpsManagerImageVersion := env .ReadOrDefault (util .InitOpsManagerVersion , "latest" )
131
131
// Namespace where the operator is installed
132
132
currentNamespace := env .ReadOrPanic (util .CurrentNamespace )
133
+ webhookSVCSelector := env .ReadOrPanic (util .OperatorNameEnv )
133
134
134
135
enableClusterMongoDBRoles := slices .Contains (crds , clusterMongoDBRoleCRDPlural )
135
136
@@ -163,7 +164,7 @@ func main() {
163
164
managerOptions .HealthProbeBindAddress = "127.0.0.1:8181"
164
165
}
165
166
166
- webhookOptions := setupWebhook (ctx , cfg , log , slices . Contains ( crds , mongoDBMultiClusterCRDPlural ) , currentNamespace )
167
+ webhookOptions := setupWebhook (ctx , cfg , log , webhookSVCSelector , currentNamespace )
167
168
managerOptions .WebhookServer = crWebhook .NewServer (webhookOptions )
168
169
169
170
mgr , err := ctrl .NewManager (cfg , managerOptions )
@@ -393,7 +394,7 @@ func isInLocalMode() bool {
393
394
394
395
// setupWebhook sets up the validation webhook for MongoDB resources in order
395
396
// 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 {
397
398
// set webhook port — 1993 is chosen as Ben's birthday
398
399
webhookPort := env .ReadIntOrDefault (util .MdbWebhookPortEnv , 1993 )
399
400
@@ -419,7 +420,7 @@ func setupWebhook(ctx context.Context, cfg *rest.Config, log *zap.SugaredLogger,
419
420
Namespace : currentNamespace ,
420
421
}
421
422
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 {
423
424
log .Errorf ("could not set up webhook: %v" , err )
424
425
}
425
426
0 commit comments