From be051cd0b2693bf6cb03927bc3c738a6d8e65665 Mon Sep 17 00:00:00 2001 From: Piotr Halama Date: Wed, 31 Jan 2024 12:36:23 +0100 Subject: [PATCH] register webhook with the manager --- cmd/admission/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/admission/main.go b/cmd/admission/main.go index 18b304b3..39a05ed2 100644 --- a/cmd/admission/main.go +++ b/cmd/admission/main.go @@ -105,6 +105,10 @@ func main() { os.Exit(1) } + whs := ctrlwebhook.NewServer(ctrlwebhook.Options{ + CertName: certs.CertFile, + KeyName: certs.KeyFile}) + mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), manager.Options{ Scheme: scheme, Port: appConfig.Admission.Port, @@ -115,6 +119,7 @@ func main() { &corev1.Secret{}, &corev1.ConfigMap{}, }, + WebhookServer: whs, }) if err != nil { logger.Error("failed to start manager", err.Error()) @@ -150,9 +155,6 @@ func main() { logger.Info("setting up webhook server") // webhook server setup - whs := mgr.GetWebhookServer() - whs.CertName = certs.CertFile - whs.KeyName = certs.KeyFile whs.Register(admission.ValidationPath, &ctrlwebhook.Admission{ Handler: admission.NewValidationWebhook(logger.With("webhook", "validation")), })