mirror of https://github.com/k3s-io/k3s.git
kube-proxy make use of generic apiserver profiling
parent
385a61e04f
commit
33976838d9
|
@ -24,7 +24,6 @@ import (
|
|||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
"os"
|
||||
goruntime "runtime"
|
||||
"strings"
|
||||
|
@ -38,6 +37,8 @@ import (
|
|||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apiserver/pkg/server/healthz"
|
||||
"k8s.io/apiserver/pkg/server/mux"
|
||||
"k8s.io/apiserver/pkg/server/routes"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
clientgoclientset "k8s.io/client-go/kubernetes"
|
||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
|
@ -467,17 +468,14 @@ func (s *ProxyServer) Run() error {
|
|||
|
||||
// Start up a metrics server if requested
|
||||
if len(s.MetricsBindAddress) > 0 {
|
||||
mux := http.NewServeMux()
|
||||
mux := mux.NewPathRecorderMux("kube-proxy")
|
||||
healthz.InstallHandler(mux)
|
||||
mux.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "%s", s.ProxyMode)
|
||||
})
|
||||
mux.Handle("/metrics", prometheus.Handler())
|
||||
if s.EnableProfiling {
|
||||
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
|
||||
routes.Profiling{}.Install(mux)
|
||||
}
|
||||
configz.InstallHandler(mux)
|
||||
go wait.Until(func() {
|
||||
|
|
Loading…
Reference in New Issue