INNER CODE UNIT · Go
setupProbeEndpoints
kubernetes-sigs/kueue · cmd/kueue/main.go:633
func setupProbeEndpoints(mgr ctrl.Manager, certsReady <-chan struct{}) error {
defer setupLog.Info("Probe endpoints are configured on healthz and readyz")
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
return fmt.Errorf("unable to set up health check: %w", err)
}
// Wait for the webhook server to be listening before advertising the
// Kueue replica as ready. This allows users to wait with sending the first
// requests, requiring webhooks, until the Kueue deployment is available, so
// that the early requests are not rejected during the Kueue's startup.
// We wrap the call to GetWebhookServer in a closure to delay calling
// the function, otherwise a not fully-initialized webhook server (without
// ready certs) fails the start of the manager.
if err := mgr.AddReadyzCheck("readyz", func(req *http.Request) error {
select {
case <-certsReady:
return mgr.GetWebhookServer().StartedChecker()(req)