From cab2a0ca16150df32970f62426c929a209cc2926 Mon Sep 17 00:00:00 2001 From: Rajat Chopra Date: Thu, 1 Dec 2016 20:22:26 -0500 Subject: [PATCH] fix for bz1400609; if the node status flips on the order of ip addresses (when there are multiple NICs to report), do not let the SDN chase it --- pkg/sdn/plugin/subnets.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/sdn/plugin/subnets.go b/pkg/sdn/plugin/subnets.go index b584a2934111..a885059978c5 100644 --- a/pkg/sdn/plugin/subnets.go +++ b/pkg/sdn/plugin/subnets.go @@ -105,6 +105,15 @@ func (master *OsdnMaster) deleteNode(nodeName string) error { return nil } +func isValidNodeIP(node *kapi.Node, nodeIP string) bool { + for _, addr := range node.Status.Addresses { + if addr.Address == nodeIP { + return true + } + } + return false +} + func getNodeIP(node *kapi.Node) (string, error) { if len(node.Status.Addresses) > 0 && node.Status.Addresses[0].Address != "" { return node.Status.Addresses[0].Address, nil @@ -169,7 +178,7 @@ func (master *OsdnMaster) watchNodes() { case cache.Sync, cache.Added, cache.Updated: master.clearInitialNodeNetworkUnavailableCondition(node) - if oldNodeIP, ok := nodeAddressMap[uid]; ok && (oldNodeIP == nodeIP) { + if oldNodeIP, ok := nodeAddressMap[uid]; ok && ((nodeIP == oldNodeIP) || isValidNodeIP(node, oldNodeIP)) { break } // Node status is frequently updated by kubelet, so log only if the above condition is not met