Skip to content

Commit 3518f6b

Browse files
committed
controller: check condition NodeNetworkUnavailable when determining whether node is ready (kubeovn#4917)
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
1 parent 7ef9eba commit 3518f6b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/controller/node.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ func (c *Controller) enqueueAddNode(obj interface{}) {
4545
}
4646

4747
func nodeReady(node *v1.Node) bool {
48-
for _, con := range node.Status.Conditions {
49-
if con.Type == v1.NodeReady && con.Status == v1.ConditionTrue {
50-
return true
48+
var ready, networkUnavailable bool
49+
for _, c := range node.Status.Conditions {
50+
switch c.Type {
51+
case v1.NodeReady:
52+
ready = c.Status == v1.ConditionTrue
53+
case v1.NodeNetworkUnavailable:
54+
networkUnavailable = c.Status == v1.ConditionTrue
5155
}
5256
}
53-
return false
57+
return ready && !networkUnavailable
5458
}
5559

5660
func (c *Controller) enqueueUpdateNode(oldObj, newObj interface{}) {

0 commit comments

Comments
 (0)