mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Clear ingress resources on graceful shutdown
Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
59832beb31
commit
ded6e1934a
1 changed files with 26 additions and 21 deletions
|
@ -324,27 +324,7 @@ func (c *controller) clusterAgentInit() {
|
||||||
c.agentClose()
|
c.agentClose()
|
||||||
c.cleanupServiceBindings("")
|
c.cleanupServiceBindings("")
|
||||||
|
|
||||||
c.Lock()
|
c.clearIngress(true)
|
||||||
ingressSandbox := c.ingressSandbox
|
|
||||||
c.ingressSandbox = nil
|
|
||||||
c.Unlock()
|
|
||||||
|
|
||||||
if ingressSandbox != nil {
|
|
||||||
if err := ingressSandbox.Delete(); err != nil {
|
|
||||||
log.Warnf("Could not delete ingress sandbox while leaving: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
n, err := c.NetworkByName("ingress")
|
|
||||||
if err != nil {
|
|
||||||
log.Warnf("Could not find ingress network while leaving: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if n != nil {
|
|
||||||
if err := n.Delete(); err != nil {
|
|
||||||
log.Warnf("Could not delete ingress network while leaving: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1088,32 @@ func (c *controller) getIPAMDriver(name string) (ipamapi.Ipam, *ipamapi.Capabili
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *controller) Stop() {
|
func (c *controller) Stop() {
|
||||||
|
c.clearIngress(false)
|
||||||
c.closeStores()
|
c.closeStores()
|
||||||
c.stopExternalKeyListener()
|
c.stopExternalKeyListener()
|
||||||
osl.GC()
|
osl.GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *controller) clearIngress(clusterLeave bool) {
|
||||||
|
c.Lock()
|
||||||
|
ingressSandbox := c.ingressSandbox
|
||||||
|
c.ingressSandbox = nil
|
||||||
|
c.Unlock()
|
||||||
|
|
||||||
|
if ingressSandbox != nil {
|
||||||
|
if err := ingressSandbox.Delete(); err != nil {
|
||||||
|
log.Warnf("Could not delete ingress sandbox while leaving: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
n, err := c.NetworkByName("ingress")
|
||||||
|
if err != nil && clusterLeave {
|
||||||
|
log.Warnf("Could not find ingress network while leaving: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if n != nil {
|
||||||
|
if err := n.Delete(); err != nil {
|
||||||
|
log.Warnf("Could not delete ingress network while leaving: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue