INNER CODE UNIT · Go
setupProbeEndpoints
kubeflow/trainer · cmd/trainer-controller-manager/main.go:195
func setupProbeEndpoints(mgr ctrl.Manager, certsReady <-chan struct{}, options ctrl.Options) {
defer setupLog.Info("Probe endpoints are configured",
"liveness", options.LivenessEndpointName, "readiness", options.ReadinessEndpointName)
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up health check")
os.Exit(1)
}
// Wait for the webhook server to be listening before advertising the
// training-operator replica as ready. This allows users to wait with sending the first
// requests, requiring webhooks, until the training-operator deployment is available, so
// that the early requests are not rejected during the training-operator'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: