Merge pull request #29294 from yongtang/1.13.x

[1.13.x] Update vendored swarmkit to b5f07ce49c66d2f5feee83998b23d4c905b78155
This commit is contained in:
Brian Goff 2016-12-12 11:46:50 -05:00 committed by GitHub
commit cd7fea22f4
2 changed files with 18 additions and 13 deletions

View file

@ -100,7 +100,7 @@ github.com/docker/containerd 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4
# cluster
github.com/docker/swarmkit 999addf86dad33479756c83620ed727ef50bce57
github.com/docker/swarmkit b5f07ce49c66d2f5feee83998b23d4c905b78155
github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
github.com/gogo/protobuf v0.3
github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a

View file

@ -389,7 +389,7 @@ func (na *NetworkAllocator) DeallocateTask(t *api.Task) error {
func (na *NetworkAllocator) releaseEndpoints(networks []*api.NetworkAttachment) error {
for _, nAttach := range networks {
ipam, _, err := na.resolveIPAM(nAttach.Network)
ipam, _, _, err := na.resolveIPAM(nAttach.Network)
if err != nil {
return errors.Wrapf(err, "failed to resolve IPAM while allocating")
}
@ -440,7 +440,7 @@ func (na *NetworkAllocator) allocateVIP(vip *api.Endpoint_VirtualIP) error {
return nil
}
ipam, _, err := na.resolveIPAM(localNet.nw)
ipam, _, _, err := na.resolveIPAM(localNet.nw)
if err != nil {
return errors.Wrap(err, "failed to resolve IPAM while allocating")
}
@ -479,7 +479,7 @@ func (na *NetworkAllocator) deallocateVIP(vip *api.Endpoint_VirtualIP) error {
return errors.New("networkallocator: could not find local network state")
}
ipam, _, err := na.resolveIPAM(localNet.nw)
ipam, _, _, err := na.resolveIPAM(localNet.nw)
if err != nil {
return errors.Wrap(err, "failed to resolve IPAM while allocating")
}
@ -507,7 +507,7 @@ func (na *NetworkAllocator) deallocateVIP(vip *api.Endpoint_VirtualIP) error {
func (na *NetworkAllocator) allocateNetworkIPs(nAttach *api.NetworkAttachment) error {
var ip *net.IPNet
ipam, _, err := na.resolveIPAM(nAttach.Network)
ipam, _, _, err := na.resolveIPAM(nAttach.Network)
if err != nil {
return errors.Wrap(err, "failed to resolve IPAM while allocating")
}
@ -662,22 +662,27 @@ func (na *NetworkAllocator) loadDriver(name string) error {
}
// Resolve the IPAM driver
func (na *NetworkAllocator) resolveIPAM(n *api.Network) (ipamapi.Ipam, string, error) {
func (na *NetworkAllocator) resolveIPAM(n *api.Network) (ipamapi.Ipam, string, map[string]string, error) {
dName := ipamapi.DefaultIPAM
if n.Spec.IPAM != nil && n.Spec.IPAM.Driver != nil && n.Spec.IPAM.Driver.Name != "" {
dName = n.Spec.IPAM.Driver.Name
}
ipam, _ := na.drvRegistry.IPAM(dName)
if ipam == nil {
return nil, "", fmt.Errorf("could not resolve IPAM driver %s", dName)
var dOptions map[string]string
if n.Spec.IPAM != nil && n.Spec.IPAM.Driver != nil && len(n.Spec.IPAM.Driver.Options) != 0 {
dOptions = n.Spec.IPAM.Driver.Options
}
return ipam, dName, nil
ipam, _ := na.drvRegistry.IPAM(dName)
if ipam == nil {
return nil, "", nil, fmt.Errorf("could not resolve IPAM driver %s", dName)
}
return ipam, dName, dOptions, nil
}
func (na *NetworkAllocator) freePools(n *api.Network, pools map[string]string) error {
ipam, _, err := na.resolveIPAM(n)
ipam, _, _, err := na.resolveIPAM(n)
if err != nil {
return errors.Wrapf(err, "failed to resolve IPAM while freeing pools for network %s", n.ID)
}
@ -701,7 +706,7 @@ func releasePools(ipam ipamapi.Ipam, icList []*api.IPAMConfig, pools map[string]
}
func (na *NetworkAllocator) allocatePools(n *api.Network) (map[string]string, error) {
ipam, dName, err := na.resolveIPAM(n)
ipam, dName, dOptions, err := na.resolveIPAM(n)
if err != nil {
return nil, err
}
@ -736,7 +741,7 @@ func (na *NetworkAllocator) allocatePools(n *api.Network) (map[string]string, er
// Update the runtime IPAM configurations with initial state
n.IPAM = &api.IPAMOptions{
Driver: &api.Driver{Name: dName},
Driver: &api.Driver{Name: dName, Options: dOptions},
Configs: ipamConfigs,
}