mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1375 from mrjana/lb
Do not add ingress loadbalancer on service tasks
This commit is contained in:
commit
0229451f3d
1 changed files with 13 additions and 5 deletions
|
@ -261,7 +261,7 @@ func (sb *sandbox) populateLoadbalancers(ep *endpoint) {
|
||||||
addService := true
|
addService := true
|
||||||
for _, ip := range lb.backEnds {
|
for _, ip := range lb.backEnds {
|
||||||
sb.addLBBackend(ip, lb.vip, lb.fwMark, lb.service.ingressPorts,
|
sb.addLBBackend(ip, lb.vip, lb.fwMark, lb.service.ingressPorts,
|
||||||
eIP, gwIP, addService)
|
eIP, gwIP, addService, n.ingress)
|
||||||
addService = false
|
addService = false
|
||||||
}
|
}
|
||||||
lb.service.Unlock()
|
lb.service.Unlock()
|
||||||
|
@ -284,7 +284,7 @@ func (n *network) addLBBackend(ip, vip net.IP, fwMark uint32, ingressPorts []*Po
|
||||||
gwIP = ep.Iface().Address().IP
|
gwIP = ep.Iface().Address().IP
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.addLBBackend(ip, vip, fwMark, ingressPorts, ep.Iface().Address(), gwIP, addService)
|
sb.addLBBackend(ip, vip, fwMark, ingressPorts, ep.Iface().Address(), gwIP, addService, n.ingress)
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
@ -307,7 +307,7 @@ func (n *network) rmLBBackend(ip, vip net.IP, fwMark uint32, ingressPorts []*Por
|
||||||
gwIP = ep.Iface().Address().IP
|
gwIP = ep.Iface().Address().IP
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.rmLBBackend(ip, vip, fwMark, ingressPorts, ep.Iface().Address(), gwIP, rmService)
|
sb.rmLBBackend(ip, vip, fwMark, ingressPorts, ep.Iface().Address(), gwIP, rmService, n.ingress)
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
@ -315,11 +315,15 @@ func (n *network) rmLBBackend(ip, vip net.IP, fwMark uint32, ingressPorts []*Por
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add loadbalancer backend into one connected sandbox.
|
// Add loadbalancer backend into one connected sandbox.
|
||||||
func (sb *sandbox) addLBBackend(ip, vip net.IP, fwMark uint32, ingressPorts []*PortConfig, eIP *net.IPNet, gwIP net.IP, addService bool) {
|
func (sb *sandbox) addLBBackend(ip, vip net.IP, fwMark uint32, ingressPorts []*PortConfig, eIP *net.IPNet, gwIP net.IP, addService bool, isIngressNetwork bool) {
|
||||||
if sb.osSbox == nil {
|
if sb.osSbox == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isIngressNetwork && !sb.ingress {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
i, err := ipvs.New(sb.Key())
|
i, err := ipvs.New(sb.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("Failed to create an ipvs handle for sbox %s: %v", sb.Key(), err)
|
logrus.Errorf("Failed to create an ipvs handle for sbox %s: %v", sb.Key(), err)
|
||||||
|
@ -370,11 +374,15 @@ func (sb *sandbox) addLBBackend(ip, vip net.IP, fwMark uint32, ingressPorts []*P
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove loadbalancer backend from one connected sandbox.
|
// Remove loadbalancer backend from one connected sandbox.
|
||||||
func (sb *sandbox) rmLBBackend(ip, vip net.IP, fwMark uint32, ingressPorts []*PortConfig, eIP *net.IPNet, gwIP net.IP, rmService bool) {
|
func (sb *sandbox) rmLBBackend(ip, vip net.IP, fwMark uint32, ingressPorts []*PortConfig, eIP *net.IPNet, gwIP net.IP, rmService bool, isIngressNetwork bool) {
|
||||||
if sb.osSbox == nil {
|
if sb.osSbox == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isIngressNetwork && !sb.ingress {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
i, err := ipvs.New(sb.Key())
|
i, err := ipvs.New(sb.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("Failed to create an ipvs handle for sbox %s: %v", sb.Key(), err)
|
logrus.Errorf("Failed to create an ipvs handle for sbox %s: %v", sb.Key(), err)
|
||||||
|
|
Loading…
Reference in a new issue