Skip to content

Commit

Permalink
Add webhook to controller manager
Browse files Browse the repository at this point in the history
Signed-off-by: Abhijit Mukherjee <[email protected]>
  • Loading branch information
mabhi committed Feb 22, 2024
1 parent 2cb20ac commit d69153d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/reposervercontroller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ func main() {
hookServerOptions := webhook.Options{CertDir: validatingwebhook.WHCertsDir, Port: webhookServerPort}
hookServer := webhook.NewServer(hookServerOptions)
webhook := admission.WithCustomValidator(mgr.GetScheme(), &crv1alpha1.RepositoryServer{}, &validatingwebhook.RepositoryServerValidator{})
// registers a webhooks to a webhook server that gets ran by a controller manager.
hookServer.Register(whHandlePath, webhook)
if err := mgr.Add(hookServer); err != nil {
setupLog.Error(err, "Failed to add webhook server to the manager")
os.Exit(1)
}
}
}

Expand Down

0 comments on commit d69153d

Please sign in to comment.