Skip to content

Commit f4a15a0

Browse files
authored
Merge pull request #1803 from fcrisciani/ipvs-hardening
IPVS fix
2 parents 86ae3cf + 5929617 commit f4a15a0

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)