Browse code

Revendor swarmkit to 5a6df4b07d83e6dbd72e39e354c325dc9b91850f

This fix updates swarmkit to 5a6df4b07d83e6dbd72e39e354c325dc9b91850f.

This fix is needed by #29074 (docker PR) and is related to
docker/swarmkit#1789 (swarmkit PR) and #29044

This fix may be needed for 1.13.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

Yong Tang authored on 2016/12/10 09:28:51
Showing 2 changed files
... ...
@@ -100,7 +100,7 @@ github.com/docker/containerd 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
100 100
 github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4
101 101
 
102 102
 # cluster
103
-github.com/docker/swarmkit 5fe1f720da9c8ee66b49907d6ee415e9bfb1e5ef
103
+github.com/docker/swarmkit 5a6df4b07d83e6dbd72e39e354c325dc9b91850f
104 104
 github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
105 105
 github.com/gogo/protobuf v0.3
106 106
 github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a
... ...
@@ -389,7 +389,7 @@ func (na *NetworkAllocator) DeallocateTask(t *api.Task) error {
389 389
 
390 390
 func (na *NetworkAllocator) releaseEndpoints(networks []*api.NetworkAttachment) error {
391 391
 	for _, nAttach := range networks {
392
-		ipam, _, err := na.resolveIPAM(nAttach.Network)
392
+		ipam, _, _, err := na.resolveIPAM(nAttach.Network)
393 393
 		if err != nil {
394 394
 			return errors.Wrapf(err, "failed to resolve IPAM while allocating")
395 395
 		}
... ...
@@ -440,7 +440,7 @@ func (na *NetworkAllocator) allocateVIP(vip *api.Endpoint_VirtualIP) error {
440 440
 		return nil
441 441
 	}
442 442
 
443
-	ipam, _, err := na.resolveIPAM(localNet.nw)
443
+	ipam, _, _, err := na.resolveIPAM(localNet.nw)
444 444
 	if err != nil {
445 445
 		return errors.Wrap(err, "failed to resolve IPAM while allocating")
446 446
 	}
... ...
@@ -479,7 +479,7 @@ func (na *NetworkAllocator) deallocateVIP(vip *api.Endpoint_VirtualIP) error {
479 479
 		return errors.New("networkallocator: could not find local network state")
480 480
 	}
481 481
 
482
-	ipam, _, err := na.resolveIPAM(localNet.nw)
482
+	ipam, _, _, err := na.resolveIPAM(localNet.nw)
483 483
 	if err != nil {
484 484
 		return errors.Wrap(err, "failed to resolve IPAM while allocating")
485 485
 	}
... ...
@@ -507,7 +507,7 @@ func (na *NetworkAllocator) deallocateVIP(vip *api.Endpoint_VirtualIP) error {
507 507
 func (na *NetworkAllocator) allocateNetworkIPs(nAttach *api.NetworkAttachment) error {
508 508
 	var ip *net.IPNet
509 509
 
510
-	ipam, _, err := na.resolveIPAM(nAttach.Network)
510
+	ipam, _, _, err := na.resolveIPAM(nAttach.Network)
511 511
 	if err != nil {
512 512
 		return errors.Wrap(err, "failed to resolve IPAM while allocating")
513 513
 	}
... ...
@@ -662,22 +662,27 @@ func (na *NetworkAllocator) loadDriver(name string) error {
662 662
 }
663 663
 
664 664
 // Resolve the IPAM driver
665
-func (na *NetworkAllocator) resolveIPAM(n *api.Network) (ipamapi.Ipam, string, error) {
665
+func (na *NetworkAllocator) resolveIPAM(n *api.Network) (ipamapi.Ipam, string, map[string]string, error) {
666 666
 	dName := ipamapi.DefaultIPAM
667 667
 	if n.Spec.IPAM != nil && n.Spec.IPAM.Driver != nil && n.Spec.IPAM.Driver.Name != "" {
668 668
 		dName = n.Spec.IPAM.Driver.Name
669 669
 	}
670 670
 
671
+	var dOptions map[string]string
672
+	if n.Spec.IPAM != nil && n.Spec.IPAM.Driver != nil && len(n.Spec.IPAM.Driver.Options) != 0 {
673
+		dOptions = n.Spec.IPAM.Driver.Options
674
+	}
675
+
671 676
 	ipam, _ := na.drvRegistry.IPAM(dName)
672 677
 	if ipam == nil {
673
-		return nil, "", fmt.Errorf("could not resolve IPAM driver %s", dName)
678
+		return nil, "", nil, fmt.Errorf("could not resolve IPAM driver %s", dName)
674 679
 	}
675 680
 
676
-	return ipam, dName, nil
681
+	return ipam, dName, dOptions, nil
677 682
 }
678 683
 
679 684
 func (na *NetworkAllocator) freePools(n *api.Network, pools map[string]string) error {
680
-	ipam, _, err := na.resolveIPAM(n)
685
+	ipam, _, _, err := na.resolveIPAM(n)
681 686
 	if err != nil {
682 687
 		return errors.Wrapf(err, "failed to resolve IPAM while freeing pools for network %s", n.ID)
683 688
 	}
... ...
@@ -701,7 +706,7 @@ func releasePools(ipam ipamapi.Ipam, icList []*api.IPAMConfig, pools map[string]
701 701
 }
702 702
 
703 703
 func (na *NetworkAllocator) allocatePools(n *api.Network) (map[string]string, error) {
704
-	ipam, dName, err := na.resolveIPAM(n)
704
+	ipam, dName, dOptions, err := na.resolveIPAM(n)
705 705
 	if err != nil {
706 706
 		return nil, err
707 707
 	}
... ...
@@ -736,7 +741,7 @@ func (na *NetworkAllocator) allocatePools(n *api.Network) (map[string]string, er
736 736
 
737 737
 	// Update the runtime IPAM configurations with initial state
738 738
 	n.IPAM = &api.IPAMOptions{
739
-		Driver:  &api.Driver{Name: dName},
739
+		Driver:  &api.Driver{Name: dName, Options: dOptions},
740 740
 		Configs: ipamConfigs,
741 741
 	}
742 742