Merge pull request #135232 from jsut21/kubelet/healthz-untilwithcontext-126379

kubelet: use wait.UntilWithContext for healthz server (structured logging)
This commit is contained in:
Kubernetes Prow Robot 2025-12-17 19:59:54 -08:00 committed by GitHub
commit cd48cabb04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -905,12 +905,12 @@ func run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Depend
if s.HealthzPort > 0 {
mux := http.NewServeMux()
healthz.InstallHandler(mux)
go wait.Until(func() {
go wait.UntilWithContext(ctx, func(ctx context.Context) {
err := http.ListenAndServe(net.JoinHostPort(s.HealthzBindAddress, strconv.Itoa(int(s.HealthzPort))), mux)
if err != nil {
logger.Error(err, "Failed to start healthz server")
}
}, 5*time.Second, wait.NeverStop)
}, 5*time.Second)
}
// If systemd is used, notify it that we have started