Fixing a stale endpoint issue that blocks ingress network cleanup

fixes #24400

Signed-off-by: Madhu Venugopal <madhu@docker.com>
(cherry picked from commit a4926a4d92)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Madhu Venugopal 2016-07-12 11:27:58 -07:00 committed by Tibor Vass
parent 6ce4e9b50c
commit 9a0e0cccfe

View file

@ -127,6 +127,14 @@ func (daemon *Daemon) SetupIngress(create clustertypes.NetworkCreateRequest, nod
return
}
// Cleanup any stale endpoints that might be left over during previous iterations
epList := n.Endpoints()
for _, ep := range epList {
if err := ep.Delete(true); err != nil {
logrus.Errorf("Failed to delete endpoint %s (%s): %v", ep.Name(), ep.ID(), err)
}
}
if err := n.Delete(); err != nil {
logrus.Errorf("Failed to delete stale ingress network %s: %v", n.ID(), err)
return