mirror of https://github.com/k3s-io/k3s
Merge pull request #79182 from tallclair/automated-cherry-pick-of-#78313-upstream-release-1.14
Automated cherry pick of #78313: Avoid the default server muxk3s-v1.14.4
commit
2cc5100933
|
@ -708,9 +708,10 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.HealthzPort > 0 {
|
if s.HealthzPort > 0 {
|
||||||
healthz.DefaultHealthz()
|
mux := http.NewServeMux()
|
||||||
|
healthz.InstallHandler(mux)
|
||||||
go wait.Until(func() {
|
go wait.Until(func() {
|
||||||
err := http.ListenAndServe(net.JoinHostPort(s.HealthzBindAddress, strconv.Itoa(int(s.HealthzPort))), nil)
|
err := http.ListenAndServe(net.JoinHostPort(s.HealthzBindAddress, strconv.Itoa(int(s.HealthzPort))), mux)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("Starting health server failed: %v", err)
|
klog.Errorf("Starting health server failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,5 @@ limitations under the License.
|
||||||
// Package healthz implements basic http server health checking.
|
// Package healthz implements basic http server health checking.
|
||||||
// Usage:
|
// Usage:
|
||||||
// import "k8s.io/apiserver/pkg/server/healthz"
|
// import "k8s.io/apiserver/pkg/server/healthz"
|
||||||
// healthz.DefaultHealthz()
|
// healthz.InstallHandler(mux)
|
||||||
package healthz // import "k8s.io/apiserver/pkg/server/healthz"
|
package healthz // import "k8s.io/apiserver/pkg/server/healthz"
|
||||||
|
|
|
@ -37,15 +37,6 @@ type HealthzChecker interface {
|
||||||
Check(req *http.Request) error
|
Check(req *http.Request) error
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultHealthz = sync.Once{}
|
|
||||||
|
|
||||||
// DefaultHealthz installs the default healthz check to the http.DefaultServeMux.
|
|
||||||
func DefaultHealthz(checks ...HealthzChecker) {
|
|
||||||
defaultHealthz.Do(func() {
|
|
||||||
InstallHandler(http.DefaultServeMux, checks...)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// PingHealthz returns true automatically when checked
|
// PingHealthz returns true automatically when checked
|
||||||
var PingHealthz HealthzChecker = ping{}
|
var PingHealthz HealthzChecker = ping{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue