mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1419 from mrjana/lb
Do not try LB populate on interface-less endpoint
This commit is contained in:
commit
622ea9d39a
2 changed files with 27 additions and 13 deletions
|
@ -213,35 +213,44 @@ func TestNetworkRequest(t *testing.T) {
|
|||
defer testutils.SetupTestOSContext(t)()
|
||||
ipamutils.InitNetworks()
|
||||
|
||||
_, exp, err := net.ParseCIDR("172.17.0.0/16")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
nw, err := FindAvailableNetwork(ipamutils.PredefinedBroadNetworks)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !types.CompareIPNet(exp, nw) {
|
||||
t.Fatalf("exected %s. got %s", exp, nw)
|
||||
|
||||
var found bool
|
||||
for _, exp := range ipamutils.PredefinedBroadNetworks {
|
||||
if types.CompareIPNet(exp, nw) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
_, exp, err = net.ParseCIDR("10.0.0.0/24")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
if !found {
|
||||
t.Fatalf("Found unexpected broad network %s", nw)
|
||||
}
|
||||
|
||||
nw, err = FindAvailableNetwork(ipamutils.PredefinedGranularNetworks)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !types.CompareIPNet(exp, nw) {
|
||||
t.Fatalf("exected %s. got %s", exp, nw)
|
||||
|
||||
found = false
|
||||
for _, exp := range ipamutils.PredefinedGranularNetworks {
|
||||
if types.CompareIPNet(exp, nw) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
t.Fatalf("Found unexpected granular network %s", nw)
|
||||
}
|
||||
|
||||
// Add iface and ssert returned address on request
|
||||
createInterface(t, "test", "172.17.42.1/16")
|
||||
|
||||
_, exp, err = net.ParseCIDR("172.18.0.0/16")
|
||||
_, exp, err := net.ParseCIDR("172.18.0.0/16")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -267,6 +267,11 @@ func (n *network) connectedLoadbalancers() []*loadBalancer {
|
|||
func (sb *sandbox) populateLoadbalancers(ep *endpoint) {
|
||||
var gwIP net.IP
|
||||
|
||||
// This is an interface less endpoint. Nothing to do.
|
||||
if ep.Iface() == nil {
|
||||
return
|
||||
}
|
||||
|
||||
n := ep.getNetwork()
|
||||
eIP := ep.Iface().Address()
|
||||
|
||||
|
|
Loading…
Reference in a new issue