Commit 4d155cf7 authored by Lei Gong's avatar Lei Gong

Fix some shadow declaration in cmd package

Signed-off-by: 's avatarLei Gong <lgong@alauda.io>
parent 56482005
...@@ -482,38 +482,38 @@ func makeLeaderElectionConfig(config componentconfig.KubeSchedulerLeaderElection ...@@ -482,38 +482,38 @@ func makeLeaderElectionConfig(config componentconfig.KubeSchedulerLeaderElection
// embed the metrics handler if the healthz and metrics address configurations // embed the metrics handler if the healthz and metrics address configurations
// are the same. // are the same.
func makeHealthzServer(config *componentconfig.KubeSchedulerConfiguration) *http.Server { func makeHealthzServer(config *componentconfig.KubeSchedulerConfiguration) *http.Server {
mux := mux.NewPathRecorderMux("kube-scheduler") pathRecorderMux := mux.NewPathRecorderMux("kube-scheduler")
healthz.InstallHandler(mux) healthz.InstallHandler(pathRecorderMux)
if config.HealthzBindAddress == config.MetricsBindAddress { if config.HealthzBindAddress == config.MetricsBindAddress {
configz.InstallHandler(mux) configz.InstallHandler(pathRecorderMux)
mux.Handle("/metrics", prometheus.Handler()) pathRecorderMux.Handle("/metrics", prometheus.Handler())
} }
if config.EnableProfiling { if config.EnableProfiling {
routes.Profiling{}.Install(mux) routes.Profiling{}.Install(pathRecorderMux)
if config.EnableContentionProfiling { if config.EnableContentionProfiling {
goruntime.SetBlockProfileRate(1) goruntime.SetBlockProfileRate(1)
} }
} }
return &http.Server{ return &http.Server{
Addr: config.HealthzBindAddress, Addr: config.HealthzBindAddress,
Handler: mux, Handler: pathRecorderMux,
} }
} }
// makeMetricsServer builds a metrics server from the config. // makeMetricsServer builds a metrics server from the config.
func makeMetricsServer(config *componentconfig.KubeSchedulerConfiguration) *http.Server { func makeMetricsServer(config *componentconfig.KubeSchedulerConfiguration) *http.Server {
mux := mux.NewPathRecorderMux("kube-scheduler") pathRecorderMux := mux.NewPathRecorderMux("kube-scheduler")
configz.InstallHandler(mux) configz.InstallHandler(pathRecorderMux)
mux.Handle("/metrics", prometheus.Handler()) pathRecorderMux.Handle("/metrics", prometheus.Handler())
if config.EnableProfiling { if config.EnableProfiling {
routes.Profiling{}.Install(mux) routes.Profiling{}.Install(pathRecorderMux)
if config.EnableContentionProfiling { if config.EnableContentionProfiling {
goruntime.SetBlockProfileRate(1) goruntime.SetBlockProfileRate(1)
} }
} }
return &http.Server{ return &http.Server{
Addr: config.MetricsBindAddress, Addr: config.MetricsBindAddress,
Handler: mux, Handler: pathRecorderMux,
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment