diff --git a/main.go b/main.go index 8abeb1fc..43651483 100644 --- a/main.go +++ b/main.go @@ -164,20 +164,22 @@ func main() { cinderv1beta1.SetupDefaults() // Setup webhooks if requested + checker := healthz.Ping if strings.ToLower(os.Getenv("ENABLE_WEBHOOKS")) != "false" { if err = (&cinderv1beta1.Cinder{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "Cinder") os.Exit(1) } + checker = mgr.GetWebhookServer().StartedChecker() } //+kubebuilder:scaffold:builder - if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { + if err := mgr.AddHealthzCheck("healthz", checker); err != nil { setupLog.Error(err, "unable to set up health check") os.Exit(1) } - if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { + if err := mgr.AddReadyzCheck("readyz", checker); err != nil { setupLog.Error(err, "unable to set up ready check") os.Exit(1) }