Skip to content

Commit 661c21e

Browse files
committed
Fix webhook server initialization
Signed-off-by: pbzweihander <[email protected]>
1 parent ea1d794 commit 661c21e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

cmd/operator/app/command.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,6 @@ func NewOperatorCommand() *cobra.Command {
8484
setupLog := ctrl.Log.WithName("setup")
8585
cfg := ctrl.GetConfigOrDie()
8686

87-
webhookServer := webhook.NewServer(webhook.Options{})
88-
if o.EnableAdmissionWebhook {
89-
webhookServerOptions := webhook.Options{
90-
Port: o.AdmissionWebhookPort,
91-
CertDir: o.AdmissionWebhookCertDir,
92-
}
93-
webhookServer = webhook.NewServer(webhookServerOptions)
94-
}
9587
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
9688
Scheme: scheme,
9789
HealthProbeBindAddress: o.HealthProbeAddr,
@@ -100,8 +92,15 @@ func NewOperatorCommand() *cobra.Command {
10092
Metrics: metricsserver.Options{
10193
BindAddress: o.MetricsAddr,
10294
},
103-
WebhookServer: webhookServer,
10495
})
96+
if o.EnableAdmissionWebhook {
97+
webhookServerOptions := webhook.Options{
98+
Port: o.AdmissionWebhookPort,
99+
CertDir: o.AdmissionWebhookCertDir,
100+
}
101+
webhookServer := webhook.NewServer(webhookServerOptions)
102+
mgr.Add(webhookServer)
103+
}
105104
if err != nil {
106105
setupLog.Error(err, "unable to start manager")
107106
os.Exit(1)

0 commit comments

Comments
 (0)