From b9741c1a20b3e1ce824ec577983f92754ff0da0b Mon Sep 17 00:00:00 2001 From: w00417949 Date: Thu, 7 Nov 2019 16:41:16 +0800 Subject: [PATCH] fix filter NotReady node --- pkg/scheduler/api/node_info.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/scheduler/api/node_info.go b/pkg/scheduler/api/node_info.go index a8c7d15885..9bb8924288 100644 --- a/pkg/scheduler/api/node_info.go +++ b/pkg/scheduler/api/node_info.go @@ -126,6 +126,17 @@ func (ni *NodeInfo) setNodeState(node *v1.Node) { return } + // If node not ready, e.g. power off + for _, cond := range node.Status.Conditions { + if cond.Type == v1.NodeReady && cond.Status != v1.ConditionTrue { + ni.State = NodeState{ + Phase: NotReady, + Reason: "NotReady", + } + return + } + } + // Node is ready (ignore node conditions because of taint/toleration) ni.State = NodeState{ Phase: Ready,