|
@@ -161,6 +161,19 @@ func (c *controller) getLBIndex(sid, nid string, ingressPorts []*PortConfig) int
|
|
|
return int(lb.fwMark)
|
|
|
}
|
|
|
|
|
|
+// cleanupServiceDiscovery when the network is being deleted, erase all the associated service discovery records
|
|
|
+func (c *controller) cleanupServiceDiscovery(cleanupNID string) {
|
|
|
+ c.Lock()
|
|
|
+ defer c.Unlock()
|
|
|
+ if cleanupNID == "" {
|
|
|
+ logrus.Debugf("cleanupServiceDiscovery for all networks")
|
|
|
+ c.svcRecords = make(map[string]svcInfo)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ logrus.Debugf("cleanupServiceDiscovery for network:%s", cleanupNID)
|
|
|
+ delete(c.svcRecords, cleanupNID)
|
|
|
+}
|
|
|
+
|
|
|
func (c *controller) cleanupServiceBindings(cleanupNID string) {
|
|
|
var cleanupFuncs []func()
|
|
|
|
|
@@ -184,15 +197,6 @@ func (c *controller) cleanupServiceBindings(cleanupNID string) {
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
- // The network is being deleted, erase all the associated service discovery records
|
|
|
- // TODO(fcrisciani) separate the Load Balancer from the Service discovery, this operation
|
|
|
- // can be done safely here, but the rmServiceBinding is still keeping consistency in the
|
|
|
- // data structures that are tracking the endpoint to IP mapping.
|
|
|
- c.Lock()
|
|
|
- logrus.Debugf("cleanupServiceBindings erasing the svcRecords for %s", nid)
|
|
|
- delete(c.svcRecords, nid)
|
|
|
- c.Unlock()
|
|
|
-
|
|
|
for eid, ip := range lb.backEnds {
|
|
|
epID := eid
|
|
|
epIP := ip
|