Commit 570232b9 authored by Wojciech Tyczynski's avatar Wojciech Tyczynski

Fix GetReadySchedulableNodes function

parent 0499108c
...@@ -2598,7 +2598,10 @@ func GetReadySchedulableNodesOrDie(c *client.Client) (nodes *api.NodeList) { ...@@ -2598,7 +2598,10 @@ func GetReadySchedulableNodesOrDie(c *client.Client) (nodes *api.NodeList) {
// previous tests may have cause failures of some nodes. Let's skip // previous tests may have cause failures of some nodes. Let's skip
// 'Not Ready' nodes, just in case (there is no need to fail the test). // 'Not Ready' nodes, just in case (there is no need to fail the test).
FilterNodes(nodes, func(node api.Node) bool { FilterNodes(nodes, func(node api.Node) bool {
return !node.Spec.Unschedulable && IsNodeConditionSetAsExpected(&node, api.NodeReady, true) nodeReady := IsNodeConditionSetAsExpected(&node, api.NodeReady, true)
networkReady := IsNodeConditionUnset(&node, api.NodeNetworkUnavailable) ||
IsNodeConditionSetAsExpected(&node, api.NodeNetworkUnavailable, false)
return !node.Spec.Unschedulable && nodeReady && networkReady
}) })
return nodes return nodes
} }
...@@ -3389,6 +3392,15 @@ func IsNodeConditionSetAsExpected(node *api.Node, conditionType api.NodeConditio ...@@ -3389,6 +3392,15 @@ func IsNodeConditionSetAsExpected(node *api.Node, conditionType api.NodeConditio
return false return false
} }
func IsNodeConditionUnset(node *api.Node, conditionType api.NodeConditionType) bool {
for _, cond := range node.Status.Conditions {
if cond.Type == conditionType {
return false
}
}
return true
}
// WaitForNodeToBe returns whether node "name's" condition state matches wantTrue // WaitForNodeToBe returns whether node "name's" condition state matches wantTrue
// within timeout. If wantTrue is true, it will ensure the node condition status // within timeout. If wantTrue is true, it will ensure the node condition status
// is ConditionTrue; if it's false, it ensures the node condition is in any state // is ConditionTrue; if it's false, it ensures the node condition is in any state
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment