From 6d86656f5e66aba07f969b09c47198fe2a58b17c Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Sun, 13 May 2018 09:14:09 +0530 Subject: [PATCH] fix wrong use of advertiseVIPs where withdrawVIPs is required (#436) --- pkg/controllers/routing/ecmp_vip.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/controllers/routing/ecmp_vip.go b/pkg/controllers/routing/ecmp_vip.go index 12bff35c..ebfbcfd6 100644 --- a/pkg/controllers/routing/ecmp_vip.go +++ b/pkg/controllers/routing/ecmp_vip.go @@ -93,6 +93,7 @@ func (nrc *NetworkRoutingController) OnServiceUpdate(obj interface{}) { return } + // update export policies so that new VIP's gets addedd to clusteripprefixsit and vip gets advertised to peers err = nrc.addExportPolicies() if err != nil { glog.Errorf("Error adding BGP export policies: %s", err.Error()) @@ -126,8 +127,14 @@ func (nrc *NetworkRoutingController) OnServiceDelete(obj interface{}) { return } + // update export policies so that deleted VIP's gets removed from clusteripprefixsit + err = nrc.addExportPolicies() + if err != nil { + glog.Errorf("Error adding BGP export policies: %s", err.Error()) + } + if len(toAdvertise) > 0 { - nrc.withdrawVIPs(toWithdraw) + nrc.withdrawVIPs(toAdvertise) } if len(toWithdraw) > 0 {