mirror of https://github.com/k3s-io/k3s
Add flag to enable contention profiling in scheduler.
parent
7a09ba96d8
commit
d8a040fee5
File diff suppressed because it is too large
Load Diff
|
@ -541,6 +541,8 @@ type KubeSchedulerConfiguration struct {
|
|||
PolicyConfigFile string `json:"policyConfigFile"`
|
||||
// enableProfiling enables profiling via web interface.
|
||||
EnableProfiling bool `json:"enableProfiling"`
|
||||
// enableContentionProfiling enables lock contention profiling, if enableProfiling is true.
|
||||
EnableContentionProfiling bool `json:"enableContentionProfiling"`
|
||||
// contentType is contentType of requests sent to apiserver.
|
||||
ContentType string `json:"contentType"`
|
||||
// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver.
|
||||
|
|
|
@ -109,6 +109,8 @@ type KubeSchedulerConfiguration struct {
|
|||
PolicyConfigFile string `json:"policyConfigFile"`
|
||||
// enableProfiling enables profiling via web interface.
|
||||
EnableProfiling *bool `json:"enableProfiling"`
|
||||
// enableContentionProfiling enables lock contention profiling, if enableProfiling is true.
|
||||
EnableContentionProfiling bool `json:"enableContentionProfiling"`
|
||||
// contentType is contentType of requests sent to apiserver.
|
||||
ContentType string `json:"contentType"`
|
||||
// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver.
|
||||
|
|
|
@ -126,6 +126,7 @@ func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSche
|
|||
if err := api.Convert_Pointer_bool_To_bool(&in.EnableProfiling, &out.EnableProfiling, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.EnableContentionProfiling = in.EnableContentionProfiling
|
||||
out.ContentType = in.ContentType
|
||||
out.KubeAPIQPS = in.KubeAPIQPS
|
||||
out.KubeAPIBurst = int32(in.KubeAPIBurst)
|
||||
|
@ -150,6 +151,7 @@ func autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSche
|
|||
if err := api.Convert_bool_To_Pointer_bool(&in.EnableProfiling, &out.EnableProfiling, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.EnableContentionProfiling = in.EnableContentionProfiling
|
||||
out.ContentType = in.ContentType
|
||||
out.KubeAPIQPS = in.KubeAPIQPS
|
||||
out.KubeAPIBurst = int(in.KubeAPIBurst)
|
||||
|
|
|
@ -105,6 +105,7 @@ func DeepCopy_v1alpha1_KubeSchedulerConfiguration(in interface{}, out interface{
|
|||
} else {
|
||||
out.EnableProfiling = nil
|
||||
}
|
||||
out.EnableContentionProfiling = in.EnableContentionProfiling
|
||||
out.ContentType = in.ContentType
|
||||
out.KubeAPIQPS = in.KubeAPIQPS
|
||||
out.KubeAPIBurst = in.KubeAPIBurst
|
||||
|
|
|
@ -188,6 +188,7 @@ func DeepCopy_componentconfig_KubeSchedulerConfiguration(in interface{}, out int
|
|||
out.AlgorithmProvider = in.AlgorithmProvider
|
||||
out.PolicyConfigFile = in.PolicyConfigFile
|
||||
out.EnableProfiling = in.EnableProfiling
|
||||
out.EnableContentionProfiling = in.EnableContentionProfiling
|
||||
out.ContentType = in.ContentType
|
||||
out.KubeAPIQPS = in.KubeAPIQPS
|
||||
out.KubeAPIBurst = in.KubeAPIBurst
|
||||
|
|
|
@ -2063,6 +2063,13 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
|||
Format: "",
|
||||
},
|
||||
},
|
||||
"enableContentionProfiling": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "enableContentionProfiling enables lock contention profiling, if enableProfiling is true.",
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"contentType": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "contentType is contentType of requests sent to apiserver.",
|
||||
|
@ -2112,7 +2119,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
|||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"TypeMeta", "port", "address", "algorithmProvider", "policyConfigFile", "enableProfiling", "contentType", "kubeAPIQPS", "kubeAPIBurst", "schedulerName", "hardPodAffinitySymmetricWeight", "failureDomains", "leaderElection"},
|
||||
Required: []string{"TypeMeta", "port", "address", "algorithmProvider", "policyConfigFile", "enableProfiling", "enableContentionProfiling", "contentType", "kubeAPIQPS", "kubeAPIBurst", "schedulerName", "hardPodAffinitySymmetricWeight", "failureDomains", "leaderElection"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
|
@ -13860,6 +13867,13 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
|||
Format: "",
|
||||
},
|
||||
},
|
||||
"enableContentionProfiling": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "enableContentionProfiling enables lock contention profiling, if enableProfiling is true.",
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"contentType": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "contentType is contentType of requests sent to apiserver.",
|
||||
|
@ -13909,7 +13923,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
|||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"TypeMeta", "port", "address", "algorithmProvider", "policyConfigFile", "enableProfiling", "contentType", "kubeAPIQPS", "kubeAPIBurst", "schedulerName", "hardPodAffinitySymmetricWeight", "failureDomains", "leaderElection"},
|
||||
Required: []string{"TypeMeta", "port", "address", "algorithmProvider", "policyConfigFile", "enableProfiling", "enableContentionProfiling", "contentType", "kubeAPIQPS", "kubeAPIBurst", "schedulerName", "hardPodAffinitySymmetricWeight", "failureDomains", "leaderElection"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
|
|
|
@ -60,6 +60,7 @@ func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
|
|||
fs.StringVar(&s.AlgorithmProvider, "algorithm-provider", s.AlgorithmProvider, "The scheduling algorithm provider to use, one of: "+factory.ListAlgorithmProviders())
|
||||
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.EnableContentionProfiling, "contention-profiling", false, "Enable lock contention profiling, if profiling is enabled")
|
||||
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
|
||||
fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")
|
||||
fs.StringVar(&s.ContentType, "kube-api-content-type", s.ContentType, "Content type of requests sent to apiserver.")
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
"net/http"
|
||||
"net/http/pprof"
|
||||
"os"
|
||||
goruntime "runtime"
|
||||
"strconv"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
|
@ -103,6 +104,9 @@ func Run(s *options.SchedulerServer) error {
|
|||
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||
if s.EnableContentionProfiling {
|
||||
goruntime.SetBlockProfileRate(1)
|
||||
}
|
||||
}
|
||||
configz.InstallHandler(mux)
|
||||
mux.Handle("/metrics", prometheus.Handler())
|
||||
|
|
Loading…
Reference in New Issue