Merge pull request #110167 from NoicFank/master

scheduling: fix duplicate checks for number of enabled queue sort plugin
This commit is contained in:
Kubernetes Prow Robot 2022-06-21 13:15:43 -07:00 committed by GitHub
commit 3d5971aa5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -331,7 +331,10 @@ func NewFramework(r Registry, profile *config.KubeSchedulerProfile, stopCh <-cha
}
if len(f.queueSortPlugins) != 1 {
return nil, fmt.Errorf("one queue sort plugin required for profile with scheduler name %q", profile.SchedulerName)
return nil, fmt.Errorf("only one queue sort plugin required for profile with scheduler name %q, but got %d", profile.SchedulerName, len(f.queueSortPlugins))
}
if len(f.bindPlugins) == 0 {
return nil, fmt.Errorf("at least one bind plugin is needed for profile with scheduler name %q", profile.SchedulerName)
}
if err := getScoreWeights(f, pluginsMap, append(profile.Plugins.Score.Enabled, profile.Plugins.MultiPoint.Enabled...)); err != nil {
@ -346,16 +349,6 @@ func NewFramework(r Registry, profile *config.KubeSchedulerProfile, stopCh <-cha
}
}
if len(f.queueSortPlugins) == 0 {
return nil, fmt.Errorf("no queue sort plugin is enabled")
}
if len(f.queueSortPlugins) > 1 {
return nil, fmt.Errorf("only one queue sort plugin can be enabled")
}
if len(f.bindPlugins) == 0 {
return nil, fmt.Errorf("at least one bind plugin is needed")
}
if options.captureProfile != nil {
if len(outputProfile.PluginConfig) != 0 {
sort.Slice(outputProfile.PluginConfig, func(i, j int) bool {