Skip to content

Commit f23dd40

Browse files
authored
Merge pull request kubernetes#84835 from denkensk/enable-profiling-default-in-scheduler
Enable profiling by default in the scheduler
2 parents f35a92c + e85ebcc commit f23dd40

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

cmd/kube-scheduler/app/options/options_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ pluginConfig:
260260
HardPodAffinitySymmetricWeight: 1,
261261
HealthzBindAddress: "0.0.0.0:10251",
262262
MetricsBindAddress: "0.0.0.0:10251",
263+
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
264+
EnableProfiling: true,
265+
EnableContentionProfiling: true,
266+
},
263267
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
264268
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
265269
LeaderElect: true,
@@ -343,6 +347,10 @@ pluginConfig:
343347
HardPodAffinitySymmetricWeight: 1,
344348
HealthzBindAddress: "", // defaults empty when not running from config file
345349
MetricsBindAddress: "", // defaults empty when not running from config file
350+
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
351+
EnableProfiling: true,
352+
EnableContentionProfiling: true,
353+
},
346354
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
347355
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
348356
LeaderElect: true,
@@ -404,6 +412,10 @@ pluginConfig:
404412
HardPodAffinitySymmetricWeight: 1,
405413
HealthzBindAddress: "", // defaults empty when not running from config file
406414
MetricsBindAddress: "", // defaults empty when not running from config file
415+
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
416+
EnableProfiling: true,
417+
EnableContentionProfiling: true,
418+
},
407419
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
408420
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
409421
LeaderElect: true,
@@ -440,6 +452,10 @@ pluginConfig:
440452
HardPodAffinitySymmetricWeight: 1,
441453
HealthzBindAddress: "0.0.0.0:10251",
442454
MetricsBindAddress: "0.0.0.0:10251",
455+
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
456+
EnableProfiling: true,
457+
EnableContentionProfiling: true,
458+
},
443459
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
444460
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
445461
LeaderElect: true,
@@ -518,6 +534,10 @@ pluginConfig:
518534
HardPodAffinitySymmetricWeight: 1,
519535
HealthzBindAddress: "0.0.0.0:10251",
520536
MetricsBindAddress: "0.0.0.0:10251",
537+
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
538+
EnableProfiling: true,
539+
EnableContentionProfiling: true,
540+
},
521541
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
522542
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
523543
LeaderElect: true,
@@ -557,6 +577,10 @@ pluginConfig:
557577
HardPodAffinitySymmetricWeight: 1,
558578
HealthzBindAddress: "0.0.0.0:10251",
559579
MetricsBindAddress: "0.0.0.0:10251",
580+
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
581+
EnableProfiling: true,
582+
EnableContentionProfiling: true,
583+
},
560584
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
561585
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
562586
LeaderElect: false,

pkg/scheduler/apis/config/v1alpha1/defaults.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,16 @@ func SetDefaults_KubeSchedulerConfiguration(obj *kubeschedulerconfigv1alpha1.Kub
156156
val := int64(10)
157157
obj.PodMaxBackoffSeconds = &val
158158
}
159+
160+
// Enable profiling by default in the scheduler
161+
if obj.EnableProfiling == nil {
162+
enableProfiling := true
163+
obj.EnableProfiling = &enableProfiling
164+
}
165+
166+
// Enable contention profiling by default if profiling is enabled
167+
if *obj.EnableProfiling && obj.EnableContentionProfiling == nil {
168+
enableContentionProfiling := true
169+
obj.EnableContentionProfiling = &enableContentionProfiling
170+
}
159171
}

pkg/scheduler/apis/config/v1alpha1/defaults_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
)
2929

3030
func TestSchedulerDefaults(t *testing.T) {
31+
enable := true
3132
tests := []struct {
3233
name string
3334
config *kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration
@@ -42,6 +43,10 @@ func TestSchedulerDefaults(t *testing.T) {
4243
HardPodAffinitySymmetricWeight: pointer.Int32Ptr(1),
4344
HealthzBindAddress: pointer.StringPtr("0.0.0.0:10251"),
4445
MetricsBindAddress: pointer.StringPtr("0.0.0.0:10251"),
46+
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
47+
EnableProfiling: &enable,
48+
EnableContentionProfiling: &enable,
49+
},
4550
LeaderElection: kubeschedulerconfigv1alpha1.KubeSchedulerLeaderElectionConfiguration{
4651
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
4752
LeaderElect: pointer.BoolPtr(true),
@@ -80,6 +85,10 @@ func TestSchedulerDefaults(t *testing.T) {
8085
HardPodAffinitySymmetricWeight: pointer.Int32Ptr(1),
8186
HealthzBindAddress: pointer.StringPtr("1.2.3.4:10251"),
8287
MetricsBindAddress: pointer.StringPtr("1.2.3.4:10251"),
88+
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
89+
EnableProfiling: &enable,
90+
EnableContentionProfiling: &enable,
91+
},
8392
LeaderElection: kubeschedulerconfigv1alpha1.KubeSchedulerLeaderElectionConfiguration{
8493
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
8594
LeaderElect: pointer.BoolPtr(true),
@@ -118,6 +127,10 @@ func TestSchedulerDefaults(t *testing.T) {
118127
HardPodAffinitySymmetricWeight: pointer.Int32Ptr(1),
119128
HealthzBindAddress: pointer.StringPtr("0.0.0.0:12345"),
120129
MetricsBindAddress: pointer.StringPtr("0.0.0.0:12345"),
130+
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
131+
EnableProfiling: &enable,
132+
EnableContentionProfiling: &enable,
133+
},
121134
LeaderElection: kubeschedulerconfigv1alpha1.KubeSchedulerLeaderElectionConfiguration{
122135
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
123136
LeaderElect: pointer.BoolPtr(true),

0 commit comments

Comments
 (0)