Skip to content

Commit 5929617

Browse files
author
Flavio Crisciani
committed
IPVS fix
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>
1 parent 86ae3cf commit 5929617

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

service_common.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,15 @@ func (c *controller) addServiceBinding(svcName, svcID, nID, eID, containerName s
237237
// Create a new load balancer if we are seeing this
238238
// network attachment on the service for the first
239239
// time.
240+
fwMarkCtrMu.Lock()
241+
240242
lb = &loadBalancer{
241243
vip: vip,
242244
fwMark: fwMarkCtr,
243245
backEnds: make(map[string]loadBalancerBackend),
244246
service: s,
245247
}
246248

247-
fwMarkCtrMu.Lock()
248249
fwMarkCtr++
249250
fwMarkCtrMu.Unlock()
250251

@@ -342,7 +343,7 @@ func (c *controller) rmServiceBinding(svcName, svcID, nID, eID, containerName st
342343

343344
// Remove loadbalancer service(if needed) and backend in all
344345
// sandboxes in the network only if the vip is valid.
345-
if len(vip) != 0 {
346+
if len(vip) != 0 && entries == 0 {
346347
n.(*network).rmLBBackend(ip, vip, lb.fwMark, ingressPorts, rmService)
347348
}
348349

0 commit comments

Comments
 (0)