mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Do not clear ingress network in libnetwork
- Now that docker has the code to release the ingress network, have docker do the release on cluster leave and on graceful daemon shutdown. This is a cleaner approach in line with the cleanup triggered by who created the resource and will avoid races on ingress network removal as revealed by the docker tests. Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
b670a16ba7
commit
b04b258243
1 changed files with 0 additions and 42 deletions
|
@ -337,9 +337,6 @@ func (c *controller) clusterAgentInit() {
|
|||
// service bindings
|
||||
c.agentClose()
|
||||
c.cleanupServiceBindings("")
|
||||
|
||||
c.clearIngress(true)
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -1153,46 +1150,7 @@ func (c *controller) getIPAMDriver(name string) (ipamapi.Ipam, *ipamapi.Capabili
|
|||
}
|
||||
|
||||
func (c *controller) Stop() {
|
||||
c.clearIngress(false)
|
||||
c.closeStores()
|
||||
c.stopExternalKeyListener()
|
||||
osl.GC()
|
||||
}
|
||||
|
||||
func (c *controller) clearIngress(clusterLeave bool) {
|
||||
c.Lock()
|
||||
ingressSandbox := c.ingressSandbox
|
||||
c.ingressSandbox = nil
|
||||
c.Unlock()
|
||||
|
||||
var n *network
|
||||
if ingressSandbox != nil {
|
||||
for _, ep := range ingressSandbox.getConnectedEndpoints() {
|
||||
if nw := ep.getNetwork(); nw.ingress {
|
||||
n = nw
|
||||
break
|
||||
}
|
||||
}
|
||||
if err := ingressSandbox.Delete(); err != nil {
|
||||
logrus.Warnf("Could not delete ingress sandbox while leaving: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if n == nil {
|
||||
for _, nw := range c.Networks() {
|
||||
if nw.Info().Ingress() {
|
||||
n = nw.(*network)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if n == nil && clusterLeave {
|
||||
logrus.Warnf("Could not find ingress network while leaving")
|
||||
}
|
||||
|
||||
if n != nil {
|
||||
if err := n.Delete(); err != nil {
|
||||
logrus.Warnf("Could not delete ingress network while leaving: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue