From 623e7dfa39ce71a511ab6383f4fb80112b3012f3 Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Fri, 3 Jun 2016 14:35:50 -0700 Subject: [PATCH] Considering all nodes for the scheduler cache to allow lookups --- plugin/pkg/scheduler/factory/factory.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugin/pkg/scheduler/factory/factory.go b/plugin/pkg/scheduler/factory/factory.go index 1a93c2b19fb..f02d7fa877b 100644 --- a/plugin/pkg/scheduler/factory/factory.go +++ b/plugin/pkg/scheduler/factory/factory.go @@ -449,6 +449,11 @@ func getNodeConditionPredicate() cache.NodeConditionPredicate { return false } } + // Ignore nodes that are marked unschedulable + if node.Spec.Unschedulable { + glog.V(4).Infof("Ignoring node %v since it is unschedulable", node.Name) + return false + } return true } } @@ -470,9 +475,10 @@ func (factory *ConfigFactory) createAssignedNonTerminatedPodLW() *cache.ListWatc // createNodeLW returns a cache.ListWatch that gets all changes to nodes. func (factory *ConfigFactory) createNodeLW() *cache.ListWatch { - // TODO: Filter out nodes that doesn't have NodeReady condition. - fields := fields.Set{api.NodeUnschedulableField: "false"}.AsSelector() - return cache.NewListWatchFromClient(factory.Client, "nodes", api.NamespaceAll, fields) + // all nodes are considered to ensure that the scheduler cache has access to all nodes for lookups + // the NodeCondition is used to filter out the nodes that are not ready or unschedulable + // the filtered list is used as the super set of nodes to consider for scheduling + return cache.NewListWatchFromClient(factory.Client, "nodes", api.NamespaceAll, fields.ParseSelectorOrDie("")) } // createPersistentVolumeLW returns a cache.ListWatch that gets all changes to persistentVolumes.