Skip to content

Commit

Permalink
Avoid NodeNetworkUnavailable condition check for every node status up…
Browse files Browse the repository at this point in the history
…date

- We know that kubelet sets NodeNetworkUnavailable condition when the node is
created/registered with api server.
- So we only need to call clearInitialNodeNetworkUnavailableCondition()
for the first time and not during subsequent node status update events.
  • Loading branch information
Ravi Sankar Penta committed Feb 27, 2018
1 parent ebda62b commit 7d5f2ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/network/master/subnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,15 @@ func (master *OsdnMaster) handleAddOrUpdateNode(obj, _ interface{}, eventType wa
utilruntime.HandleError(fmt.Errorf("Node IP is not set for node %s, skipping %s event, node: %v", node.Name, eventType, node))
return
}
master.clearInitialNodeNetworkUnavailableCondition(node)

if oldNodeIP, ok := master.hostSubnetNodeIPs[node.UID]; ok && (nodeIP == oldNodeIP) {
return
}
// Node status is frequently updated by kubelet, so log only if the above condition is not met
glog.V(5).Infof("Watch %s event for Node %q", eventType, node.Name)

master.clearInitialNodeNetworkUnavailableCondition(node)

usedNodeIP, err := master.addNode(node.Name, string(node.UID), nodeIP, nil)
if err != nil {
utilruntime.HandleError(fmt.Errorf("Error creating subnet for node %s, ip %s: %v", node.Name, nodeIP, err))
Expand Down

0 comments on commit 7d5f2ac

Please sign in to comment.