1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Cleanup ingress network and sandbox on leave

When a node leaves the swarm cluster, we should cleanup the ingress
network and sandbox. This makes sure that when the next time the node
joins the swarm it will be able to update the cluster with the right
information.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
Jana Radhakrishnan 2016-08-17 13:48:51 -07:00
parent 30b53a73c1
commit 4b80c3411d

View file

@ -308,6 +308,24 @@ func (c *controller) clusterAgentInit() {
c.clusterConfigAvailable = false
c.agentInitDone = make(chan struct{})
c.Unlock()
if err := c.ingressSandbox.Delete(); err != nil {
log.Warnf("Could not delete ingress sandbox while leaving: %v", err)
}
c.ingressSandbox = nil
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)
}
}
c.agentClose()
return
}