diff --git a/cmd/kueue/main.go b/cmd/kueue/main.go index 662af737b0..ea93bfb04c 100644 --- a/cmd/kueue/main.go +++ b/cmd/kueue/main.go @@ -279,6 +279,14 @@ func setupProbeEndpoints(mgr ctrl.Manager) { setupLog.Error(err, "unable to set up health check") os.Exit(1) } + + // Wait for the webhook server to be listening before exposing the + // Kueue replica as ready. This allows users to wait with first requests + // until the Kueue deployment is available, so that the early requests are + // not rejected during startup. + // We wrap the call to GetWebhookServer in a closure to delay calling + // the function, otherwise a not fully-initialized webook server is used for + // the checks. if err := mgr.AddReadyzCheck("readyz", func(req *http.Request) error { return mgr.GetWebhookServer().StartedChecker()(req) }); err != nil {