Skip to content

Commit

Permalink
Merge pull request kubernetes#79184 from tallclair/automated-cherry-p…
Browse files Browse the repository at this point in the history
…ick-of-#78313-upstream-release-1.12

Automated cherry pick of kubernetes#78313: Avoid the default server mux
  • Loading branch information
feiskyer authored Jun 30, 2019
2 parents 9925431 + 26849d3 commit e3c1340
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
5 changes: 3 additions & 2 deletions cmd/kubelet/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,9 +746,10 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
}

if s.HealthzPort > 0 {
healthz.DefaultHealthz()
mux := http.NewServeMux()
healthz.InstallHandler(mux)
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 {
glog.Errorf("Starting health server failed: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion staging/src/k8s.io/apiserver/pkg/server/healthz/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ limitations under the License.
// Package healthz implements basic http server health checking.
// Usage:
// import "k8s.io/apiserver/pkg/server/healthz"
// healthz.DefaultHealthz()
// healthz.InstallHandler(mux)
package healthz // import "k8s.io/apiserver/pkg/server/healthz"
9 changes: 0 additions & 9 deletions staging/src/k8s.io/apiserver/pkg/server/healthz/healthz.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ type HealthzChecker interface {
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
var PingHealthz HealthzChecker = ping{}

Expand Down

0 comments on commit e3c1340

Please sign in to comment.