From 697f9f2a63ca9f295eba61acf74ef07daf3b0386 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 17 Aug 2023 17:57:54 +0900 Subject: [PATCH] Ensure webhook is started This ensures webhook is started when controller-manager deployment becomes ready. --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index f468d397..5aee9338 100644 --- a/main.go +++ b/main.go @@ -126,19 +126,21 @@ func main() { glancev1.SetupDefaults() // Setup webhooks if requested + checker := healthz.Ping if strings.ToLower(os.Getenv("ENABLE_WEBHOOKS")) != "false" { if err = (&glancev1.Glance{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "Glance") 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) }