Merge pull request #110567 from xiaomudk/patch-2

Remove redundant variable definitions in scheduler apis defaults.go
This commit is contained in:
Kubernetes Prow Robot 2022-06-21 09:46:25 -07:00 committed by GitHub
commit a57c140a12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 18 deletions

View File

@ -121,8 +121,7 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1beta2.KubeSchedulerConfigurat
}
if obj.PercentageOfNodesToScore == nil {
percentageOfNodesToScore := int32(config.DefaultPercentageOfNodesToScore)
obj.PercentageOfNodesToScore = &percentageOfNodesToScore
obj.PercentageOfNodesToScore = pointer.Int32Ptr(config.DefaultPercentageOfNodesToScore)
}
if len(obj.LeaderElection.ResourceLock) == 0 {
@ -153,25 +152,21 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1beta2.KubeSchedulerConfigurat
componentbaseconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection)
if obj.PodInitialBackoffSeconds == nil {
val := int64(1)
obj.PodInitialBackoffSeconds = &val
obj.PodInitialBackoffSeconds = pointer.Int64(1)
}
if obj.PodMaxBackoffSeconds == nil {
val := int64(10)
obj.PodMaxBackoffSeconds = &val
obj.PodMaxBackoffSeconds = pointer.Int64(10)
}
// Enable profiling by default in the scheduler
if obj.EnableProfiling == nil {
enableProfiling := true
obj.EnableProfiling = &enableProfiling
obj.EnableProfiling = pointer.BoolPtr(true)
}
// Enable contention profiling by default if profiling is enabled
if *obj.EnableProfiling && obj.EnableContentionProfiling == nil {
enableContentionProfiling := true
obj.EnableContentionProfiling = &enableContentionProfiling
obj.EnableContentionProfiling = pointer.BoolPtr(true)
}
}

View File

@ -153,25 +153,21 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1beta3.KubeSchedulerConfigurat
componentbaseconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection)
if obj.PodInitialBackoffSeconds == nil {
val := int64(1)
obj.PodInitialBackoffSeconds = &val
obj.PodInitialBackoffSeconds = pointer.Int64(1)
}
if obj.PodMaxBackoffSeconds == nil {
val := int64(10)
obj.PodMaxBackoffSeconds = &val
obj.PodMaxBackoffSeconds = pointer.Int64(10)
}
// Enable profiling by default in the scheduler
if obj.EnableProfiling == nil {
enableProfiling := true
obj.EnableProfiling = &enableProfiling
obj.EnableProfiling = pointer.BoolPtr(true)
}
// Enable contention profiling by default if profiling is enabled
if *obj.EnableProfiling && obj.EnableContentionProfiling == nil {
enableContentionProfiling := true
obj.EnableContentionProfiling = &enableContentionProfiling
obj.EnableContentionProfiling = pointer.BoolPtr(true)
}
}