Skip to content

Commit 818474d

Browse files
committed
fix: using http to imply DefaultServeMux
Signed-off-by: j4ckstraw <[email protected]>
1 parent 6a8593f commit 818474d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/exporters/k8sexporter/k8s_exporter.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,22 @@ func (ke *k8sExporter) startHTTPReporting(npdo *options.NodeProblemDetectorOptio
8181
if npdo.ServerPort <= 0 {
8282
return
8383
}
84-
mux := http.DefaultServeMux
8584

8685
// Add healthz http request handler. Always return ok now, add more health check
8786
// logic in the future.
88-
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
87+
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
8988
w.WriteHeader(http.StatusOK)
9089
w.Write([]byte("ok"))
9190
})
9291

9392
// Add the handler to serve condition http request.
94-
mux.HandleFunc("/conditions", func(w http.ResponseWriter, r *http.Request) {
93+
http.HandleFunc("/conditions", func(w http.ResponseWriter, r *http.Request) {
9594
util.ReturnHTTPJson(w, ke.conditionManager.GetConditions())
9695
})
9796

9897
addr := net.JoinHostPort(npdo.ServerAddress, strconv.Itoa(npdo.ServerPort))
9998
go func() {
100-
err := http.ListenAndServe(addr, mux)
99+
err := http.ListenAndServe(addr, nil)
101100
if err != nil {
102101
klog.Fatalf("Failed to start server: %v", err)
103102
}

0 commit comments

Comments
 (0)