|
@@ -350,17 +350,18 @@ func (c *controller) networkWatchLoop(nw *netWatch, ep *endpoint, ecCh <-chan da
|
|
|
}
|
|
|
|
|
|
func (c *controller) processEndpointCreate(nmap map[string]*netWatch, ep *endpoint) {
|
|
|
- if !c.isDistributedControl() && ep.getNetwork().driverScope() == datastore.GlobalScope {
|
|
|
+ n := ep.getNetwork()
|
|
|
+ if !c.isDistributedControl() && n.Scope() == datastore.SwarmScope && n.driverIsMultihost() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
c.Lock()
|
|
|
- nw, ok := nmap[ep.getNetwork().ID()]
|
|
|
+ nw, ok := nmap[n.ID()]
|
|
|
c.Unlock()
|
|
|
|
|
|
if ok {
|
|
|
// Update the svc db for the local endpoint join right away
|
|
|
- ep.getNetwork().updateSvcRecord(ep, c.getLocalEps(nw), true)
|
|
|
+ n.updateSvcRecord(ep, c.getLocalEps(nw), true)
|
|
|
|
|
|
c.Lock()
|
|
|
nw.localEps[ep.ID()] = ep
|
|
@@ -381,15 +382,15 @@ func (c *controller) processEndpointCreate(nmap map[string]*netWatch, ep *endpoi
|
|
|
// Update the svc db for the local endpoint join right away
|
|
|
// Do this before adding this ep to localEps so that we don't
|
|
|
// try to update this ep's container's svc records
|
|
|
- ep.getNetwork().updateSvcRecord(ep, c.getLocalEps(nw), true)
|
|
|
+ n.updateSvcRecord(ep, c.getLocalEps(nw), true)
|
|
|
|
|
|
c.Lock()
|
|
|
nw.localEps[ep.ID()] = ep
|
|
|
- nmap[ep.getNetwork().ID()] = nw
|
|
|
+ nmap[n.ID()] = nw
|
|
|
nw.stopCh = make(chan struct{})
|
|
|
c.Unlock()
|
|
|
|
|
|
- store := c.getStore(ep.getNetwork().DataScope())
|
|
|
+ store := c.getStore(n.DataScope())
|
|
|
if store == nil {
|
|
|
return
|
|
|
}
|
|
@@ -398,7 +399,7 @@ func (c *controller) processEndpointCreate(nmap map[string]*netWatch, ep *endpoi
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- ch, err := store.Watch(ep.getNetwork().getEpCnt(), nw.stopCh)
|
|
|
+ ch, err := store.Watch(n.getEpCnt(), nw.stopCh)
|
|
|
if err != nil {
|
|
|
logrus.Warnf("Error creating watch for network: %v", err)
|
|
|
return
|
|
@@ -408,12 +409,13 @@ func (c *controller) processEndpointCreate(nmap map[string]*netWatch, ep *endpoi
|
|
|
}
|
|
|
|
|
|
func (c *controller) processEndpointDelete(nmap map[string]*netWatch, ep *endpoint) {
|
|
|
- if !c.isDistributedControl() && ep.getNetwork().driverScope() == datastore.GlobalScope {
|
|
|
+ n := ep.getNetwork()
|
|
|
+ if !c.isDistributedControl() && n.Scope() == datastore.SwarmScope && n.driverIsMultihost() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
c.Lock()
|
|
|
- nw, ok := nmap[ep.getNetwork().ID()]
|
|
|
+ nw, ok := nmap[n.ID()]
|
|
|
|
|
|
if ok {
|
|
|
delete(nw.localEps, ep.ID())
|
|
@@ -422,7 +424,7 @@ func (c *controller) processEndpointDelete(nmap map[string]*netWatch, ep *endpoi
|
|
|
// Update the svc db about local endpoint leave right away
|
|
|
// Do this after we remove this ep from localEps so that we
|
|
|
// don't try to remove this svc record from this ep's container.
|
|
|
- ep.getNetwork().updateSvcRecord(ep, c.getLocalEps(nw), false)
|
|
|
+ n.updateSvcRecord(ep, c.getLocalEps(nw), false)
|
|
|
|
|
|
c.Lock()
|
|
|
if len(nw.localEps) == 0 {
|
|
@@ -430,9 +432,9 @@ func (c *controller) processEndpointDelete(nmap map[string]*netWatch, ep *endpoi
|
|
|
|
|
|
// This is the last container going away for the network. Destroy
|
|
|
// this network's svc db entry
|
|
|
- delete(c.svcRecords, ep.getNetwork().ID())
|
|
|
+ delete(c.svcRecords, n.ID())
|
|
|
|
|
|
- delete(nmap, ep.getNetwork().ID())
|
|
|
+ delete(nmap, n.ID())
|
|
|
}
|
|
|
}
|
|
|
c.Unlock()
|