1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
In accordance with the logic for SD, remove the ipvs rules
only when there is no more endpoints using the IP

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
This commit is contained in:
Flavio Crisciani 2017-06-11 23:12:01 -07:00
parent 79bb7f8674
commit c0f59f9643

View file

@ -237,6 +237,8 @@ func (c *controller) addServiceBinding(svcName, svcID, nID, eID, containerName s
// Create a new load balancer if we are seeing this
// network attachment on the service for the first
// time.
fwMarkCtrMu.Lock()
lb = &loadBalancer{
vip: vip,
fwMark: fwMarkCtr,
@ -244,7 +246,6 @@ func (c *controller) addServiceBinding(svcName, svcID, nID, eID, containerName s
service: s,
}
fwMarkCtrMu.Lock()
fwMarkCtr++
fwMarkCtrMu.Unlock()
@ -342,7 +343,7 @@ func (c *controller) rmServiceBinding(svcName, svcID, nID, eID, containerName st
// Remove loadbalancer service(if needed) and backend in all
// sandboxes in the network only if the vip is valid.
if len(vip) != 0 {
if len(vip) != 0 && entries == 0 {
n.(*network).rmLBBackend(ip, vip, lb.fwMark, ingressPorts, rmService)
}