Skip to content

Commit

Permalink
register webhook with the manager
Browse files Browse the repository at this point in the history
  • Loading branch information
halamix2 committed Jan 31, 2024
1 parent 7f357d0 commit be051cd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/admission/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -115,6 +119,7 @@ func main() {
&corev1.Secret{},
&corev1.ConfigMap{},
},
WebhookServer: whs,
})
if err != nil {
logger.Error("failed to start manager", err.Error())
Expand Down Expand Up @@ -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")),
})
Expand Down

0 comments on commit be051cd

Please sign in to comment.