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