Browse Source

Updating moby to correspond to naming convention used in https://github.com/docker/swarmkit/pull/2385

Signed-off-by: Pradip Dhara <pradipd@microsoft.com>
Pradip Dhara 7 years ago
parent
commit
d00a07b1e6

+ 1 - 1
daemon/cluster/executor/backend.go

@@ -62,5 +62,5 @@ type Backend interface {
 	LookupImage(name string) (*types.ImageInspect, error)
 	PluginManager() *plugin.Manager
 	PluginGetter() *plugin.Store
-	GetLBAttachmentStore() *networkSettings.LBAttachmentStore
+	GetAttachmentStore() *networkSettings.AttachmentStore
 }

+ 5 - 5
daemon/cluster/executor/container/executor.go

@@ -137,18 +137,18 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
 
 func (e *executor) Configure(ctx context.Context, node *api.Node) error {
 	var ingressNA *api.NetworkAttachment
-	lbAttachments := make(map[string]string)
+	attachments := make(map[string]string)
 
-	for _, na := range node.LbAttachments {
+	for _, na := range node.Attachments {
 		if na.Network.Spec.Ingress {
 			ingressNA = na
 		}
-		lbAttachments[na.Network.ID] = na.Addresses[0]
+		attachments[na.Network.ID] = na.Addresses[0]
 	}
 
 	if ingressNA == nil {
 		e.backend.ReleaseIngress()
-		return e.backend.GetLBAttachmentStore().ResetLBAttachments(lbAttachments)
+		return e.backend.GetAttachmentStore().ResetAttachments(attachments)
 	}
 
 	options := types.NetworkCreate{
@@ -181,7 +181,7 @@ func (e *executor) Configure(ctx context.Context, node *api.Node) error {
 		return err
 	}
 
-	return e.backend.GetLBAttachmentStore().ResetLBAttachments(lbAttachments)
+	return e.backend.GetAttachmentStore().ResetAttachments(attachments)
 }
 
 // Controller returns a docker container runner.

+ 5 - 5
daemon/daemon.go

@@ -125,7 +125,7 @@ type Daemon struct {
 	hosts            map[string]bool // hosts stores the addresses the daemon is listening on
 	startupDone      chan struct{}
 
-	lbAttachmentStore network.LBAttachmentStore
+	attachmentStore network.AttachmentStore
 }
 
 // StoreHosts stores the addresses the daemon is listening on
@@ -491,7 +491,7 @@ func (daemon *Daemon) DaemonLeavesCluster() {
 		logrus.Warnf("failed to initiate ingress network removal: %v", err)
 	}
 
-	daemon.lbAttachmentStore.ClearLBAttachments()
+	daemon.attachmentStore.ClearAttachments()
 }
 
 // setClusterProvider sets a component for querying the current cluster state.
@@ -1251,7 +1251,7 @@ func fixMemorySwappiness(resources *containertypes.Resources) {
 	}
 }
 
-// GetLBAttachmentStore returns current load balancer store associated with the daemon
-func (daemon *Daemon) GetLBAttachmentStore() *network.LBAttachmentStore {
-	return &daemon.lbAttachmentStore
+// GetAttachmentStore returns current attachment store associated with the daemon
+func (daemon *Daemon) GetAttachmentStore() *network.AttachmentStore {
+	return &daemon.attachmentStore
 }

+ 1 - 1
daemon/network.go

@@ -370,7 +370,7 @@ func (daemon *Daemon) createNetwork(create types.NetworkCreateRequest, id string
 	daemon.LogNetworkEvent(n, "create")
 
 	if agent && !n.Info().Ingress() && n.Type() == "overlay" {
-		nodeIP, exists := daemon.GetLBAttachmentStore().GetLBIPForNetwork(id)
+		nodeIP, exists := daemon.GetAttachmentStore().GetIPForNetwork(id)
 		if !exists {
 			return nil, fmt.Errorf("Failed to find a load balancer IP to use for network: %v", id)
 		}

+ 15 - 15
daemon/network/settings.go

@@ -35,35 +35,35 @@ type EndpointSettings struct {
 	IPAMOperational bool
 }
 
-// LBAttachmentStore stores the load balancer IP address for a network id.
-type LBAttachmentStore struct {
+// AttachmentStore stores the load balancer IP address for a network id.
+type AttachmentStore struct {
 	//key: networkd id
 	//value: load balancer ip address
 	networkToNodeLBIP map[string]net.IP
 }
 
-// ResetLBAttachments clears any exsiting load balancer IP to network mapping and
-// sets the mapping to the given lbAttachments.
-func (lbStore *LBAttachmentStore) ResetLBAttachments(lbAttachments map[string]string) error {
-	lbStore.ClearLBAttachments()
-	for nid, nodeIP := range lbAttachments {
+// ResetAttachments clears any exsiting load balancer IP to network mapping and
+// sets the mapping to the given attachments.
+func (store *AttachmentStore) ResetAttachments(attachments map[string]string) error {
+	store.ClearAttachments()
+	for nid, nodeIP := range attachments {
 		ip, _, err := net.ParseCIDR(nodeIP)
 		if err != nil {
-			lbStore.networkToNodeLBIP = make(map[string]net.IP)
+			store.networkToNodeLBIP = make(map[string]net.IP)
 			return errors.Wrapf(err, "Failed to parse load balancer address %s", nodeIP)
 		}
-		lbStore.networkToNodeLBIP[nid] = ip
+		store.networkToNodeLBIP[nid] = ip
 	}
 	return nil
 }
 
-// ClearLBAttachments clears all the mappings of network to load balancer IP Address.
-func (lbStore *LBAttachmentStore) ClearLBAttachments() {
-	lbStore.networkToNodeLBIP = make(map[string]net.IP)
+// ClearAttachments clears all the mappings of network to load balancer IP Address.
+func (store *AttachmentStore) ClearAttachments() {
+	store.networkToNodeLBIP = make(map[string]net.IP)
 }
 
-// GetLBIPForNetwork return the load balancer IP address for the given network.
-func (lbStore *LBAttachmentStore) GetLBIPForNetwork(networkID string) (net.IP, bool) {
-	ip, exists := lbStore.networkToNodeLBIP[networkID]
+// GetIPForNetwork return the load balancer IP address for the given network.
+func (store *AttachmentStore) GetIPForNetwork(networkID string) (net.IP, bool) {
+	ip, exists := store.networkToNodeLBIP[networkID]
 	return ip, exists
 }