mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1305 from mrjana/lb
Do not remove service record while scaling down
This commit is contained in:
commit
c92c6aa795
1 changed files with 17 additions and 11 deletions
|
@ -145,22 +145,19 @@ func (c *controller) rmServiceBinding(name, sid, nid, eid string, vip net.IP, in
|
||||||
n.(*network).deleteSvcRecords("tasks."+alias, ip, nil, false)
|
n.(*network).deleteSvcRecords("tasks."+alias, ip, nil, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure to remove the right IP since if vip is
|
// If we are doing DNS RR add the endpoint IP to DNS record
|
||||||
// not valid we would have added a DNS RR record.
|
// right away.
|
||||||
svcIP := vip
|
if len(vip) == 0 {
|
||||||
if len(svcIP) == 0 {
|
n.(*network).deleteSvcRecords(name, ip, nil, false)
|
||||||
svcIP = ip
|
for _, alias := range aliases {
|
||||||
}
|
n.(*network).deleteSvcRecords(alias, ip, nil, false)
|
||||||
n.(*network).deleteSvcRecords(name, svcIP, nil, false)
|
}
|
||||||
for _, alias := range aliases {
|
|
||||||
n.(*network).deleteSvcRecords(alias, svcIP, nil, false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s.Lock()
|
s.Lock()
|
||||||
defer s.Unlock()
|
|
||||||
|
|
||||||
lb, ok := s.loadBalancers[nid]
|
lb, ok := s.loadBalancers[nid]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
s.Unlock()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +182,15 @@ func (c *controller) rmServiceBinding(name, sid, nid, eid string, vip net.IP, in
|
||||||
if len(vip) != 0 {
|
if len(vip) != 0 {
|
||||||
n.(*network).rmLBBackend(ip, vip, lb.fwMark, ingressPorts, rmService)
|
n.(*network).rmLBBackend(ip, vip, lb.fwMark, ingressPorts, rmService)
|
||||||
}
|
}
|
||||||
|
s.Unlock()
|
||||||
|
|
||||||
|
// Remove the DNS record for VIP only if we are removing the service
|
||||||
|
if rmService && len(vip) != 0 {
|
||||||
|
n.(*network).deleteSvcRecords(name, vip, nil, false)
|
||||||
|
for _, alias := range aliases {
|
||||||
|
n.(*network).deleteSvcRecords(alias, vip, nil, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue