make sure filters are executed when no predicates configured

This commit is contained in:
Abdullah Gharaibeh 2019-10-16 21:24:33 -04:00
parent f7091992c0
commit 17a6a7914c
4 changed files with 13 additions and 1 deletions

View File

@ -458,7 +458,7 @@ func (g *genericScheduler) findNodesThatFit(state *framework.CycleState, pod *v1
failedPredicateMap := FailedPredicateMap{}
filteredNodesStatuses := framework.NodeToStatusMap{}
if len(g.predicates) == 0 {
if len(g.predicates) == 0 && !g.framework.HasFilterPlugins() {
filtered = g.nodeInfoSnapshot.ListNodes()
} else {
allNodes := int32(g.cache.NodeTree().NumNodes())

View File

@ -599,6 +599,11 @@ func (f *framework) GetWaitingPod(uid types.UID) WaitingPod {
return f.waitingPods.get(uid)
}
// HasFilterPlugins returns true if at least one filter plugin is defined.
func (f *framework) HasFilterPlugins() bool {
return len(f.filterPlugins) > 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

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

View File

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