From 2499c240a955283e5ef664ca5c50a7fbdbddcefc Mon Sep 17 00:00:00 2001 From: Dingzhu Lurong <1015542478@qq.com> Date: Mon, 23 May 2022 16:34:50 +0800 Subject: [PATCH] remove duplicate checks for number of enabled queue sort plugin --- pkg/scheduler/framework/runtime/framework.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/pkg/scheduler/framework/runtime/framework.go b/pkg/scheduler/framework/runtime/framework.go index 3fa96c2530b..f099b014864 100644 --- a/pkg/scheduler/framework/runtime/framework.go +++ b/pkg/scheduler/framework/runtime/framework.go @@ -331,7 +331,10 @@ func NewFramework(r Registry, profile *config.KubeSchedulerProfile, opts ...Opti } 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, opts ...Opti } } - 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 {