kubelet: use wait.UntilWithContext for healthz server (issue #126379)

This commit is contained in:
jsut21
2025-11-08 16:26:46 +09:00
parent 173523550a
commit f157114fa9

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