Make sure score plugins are executed when no priority configured

This commit is contained in:
Jun Gong 2019-10-29 17:25:35 +08:00
parent a2eb319b31
commit b4c2b00690
4 changed files with 14 additions and 2 deletions

View File

@ -713,7 +713,7 @@ func PrioritizeNodes(
state *framework.CycleState) (framework.NodeScoreList, error) {
// If no priority configs are provided, then the EqualPriority function is applied
// This is required to generate the priority list in the required format
if len(priorityConfigs) == 0 && len(extenders) == 0 {
if len(priorityConfigs) == 0 && len(extenders) == 0 && !fwk.HasScorePlugins() {
result := make(framework.NodeScoreList, 0, len(nodes))
for i := range nodes {
hostPriority, err := EqualPriorityMap(pod, meta, nodeNameToInfo[nodes[i].Name])

View File

@ -635,6 +635,11 @@ func (f *framework) HasFilterPlugins() bool {
return len(f.filterPlugins) > 0
}
// HasScorePlugins returns true if at least one score plugin is defined.
func (f *framework) HasScorePlugins() bool {
return len(f.scorePlugins) > 0
}
// ListPlugins returns a map of extension point name to plugin names configured at each extension
// point. Returns nil if no plugins where configred.
func (f *framework) ListPlugins() map[string][]config.Plugin {

View File

@ -442,9 +442,12 @@ type Framework interface {
// code=4("skip") status.
RunBindPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) *Status
// HasFilterPlugins return true if at least one filter plugin is defined
// HasFilterPlugins returns true if at least one filter plugin is defined.
HasFilterPlugins() bool
// HasScorePlugins returns true if at least one score plugin is defined.
HasScorePlugins() bool
// ListPlugins returns a map of extension point name to list of configured Plugins.
ListPlugins() map[string][]config.Plugin
}

View File

@ -179,6 +179,10 @@ func (f *fakeFramework) HasFilterPlugins() bool {
return true
}
func (f *fakeFramework) HasScorePlugins() bool {
return true
}
func (f *fakeFramework) ListPlugins() map[string][]config.Plugin {
return nil
}