mirror of https://github.com/k3s-io/k3s
Merge pull request #6654 from GoogleCloudPlatform/revert-6623-fix_scheduler_profiling
Revert "Fix scheduler crashes when profiling is enabled"pull/6/head
commit
72fed9a2f3
|
@ -69,7 +69,7 @@ func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
|
|||
client.BindClientConfigFlags(fs, &s.ClientConfig)
|
||||
fs.StringVar(&s.AlgorithmProvider, "algorithm_provider", s.AlgorithmProvider, "The scheduling algorithm provider to use")
|
||||
fs.StringVar(&s.PolicyConfigFile, "policy_config_file", s.PolicyConfigFile, "File with scheduler policy configuration")
|
||||
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")
|
||||
fs.BoolVar(&s.EnableProfiling, "profiling", false, "Enable profiling via web interface host:port/debug/pprof/")
|
||||
}
|
||||
|
||||
// Run runs the specified SchedulerServer. This should never exit.
|
||||
|
@ -80,19 +80,13 @@ func (s *SchedulerServer) Run(_ []string) error {
|
|||
}
|
||||
|
||||
go func() {
|
||||
mux := http.NewServeMux()
|
||||
if s.EnableProfiling {
|
||||
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||
http.HandleFunc("/debug/pprof/", pprof.Index)
|
||||
http.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||
http.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||
}
|
||||
mux.Handle("/metrics", prometheus.Handler())
|
||||
|
||||
server := &http.Server{
|
||||
Addr: net.JoinHostPort(s.Address.String(), strconv.Itoa(s.Port)),
|
||||
Handler: mux,
|
||||
}
|
||||
glog.Fatal(server.ListenAndServe())
|
||||
http.Handle("/metrics", prometheus.Handler())
|
||||
http.ListenAndServe(net.JoinHostPort(s.Address.String(), strconv.Itoa(s.Port)), nil)
|
||||
}()
|
||||
|
||||
configFactory := factory.NewConfigFactory(kubeClient)
|
||||
|
|
Loading…
Reference in New Issue