mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Updating moby to correspond to naming convention used in https://github.com/docker/swarmkit/pull/2385
Signed-off-by: Pradip Dhara <pradipd@microsoft.com>
This commit is contained in:
parent
8e15b1cffb
commit
d00a07b1e6
5 changed files with 27 additions and 27 deletions
|
@ -62,5 +62,5 @@ type Backend interface {
|
||||||
LookupImage(name string) (*types.ImageInspect, error)
|
LookupImage(name string) (*types.ImageInspect, error)
|
||||||
PluginManager() *plugin.Manager
|
PluginManager() *plugin.Manager
|
||||||
PluginGetter() *plugin.Store
|
PluginGetter() *plugin.Store
|
||||||
GetLBAttachmentStore() *networkSettings.LBAttachmentStore
|
GetAttachmentStore() *networkSettings.AttachmentStore
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
func (e *executor) Configure(ctx context.Context, node *api.Node) error {
|
||||||
var ingressNA *api.NetworkAttachment
|
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 {
|
if na.Network.Spec.Ingress {
|
||||||
ingressNA = na
|
ingressNA = na
|
||||||
}
|
}
|
||||||
lbAttachments[na.Network.ID] = na.Addresses[0]
|
attachments[na.Network.ID] = na.Addresses[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
if ingressNA == nil {
|
if ingressNA == nil {
|
||||||
e.backend.ReleaseIngress()
|
e.backend.ReleaseIngress()
|
||||||
return e.backend.GetLBAttachmentStore().ResetLBAttachments(lbAttachments)
|
return e.backend.GetAttachmentStore().ResetAttachments(attachments)
|
||||||
}
|
}
|
||||||
|
|
||||||
options := types.NetworkCreate{
|
options := types.NetworkCreate{
|
||||||
|
@ -181,7 +181,7 @@ func (e *executor) Configure(ctx context.Context, node *api.Node) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.backend.GetLBAttachmentStore().ResetLBAttachments(lbAttachments)
|
return e.backend.GetAttachmentStore().ResetAttachments(attachments)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Controller returns a docker container runner.
|
// Controller returns a docker container runner.
|
||||||
|
|
|
@ -125,7 +125,7 @@ type Daemon struct {
|
||||||
hosts map[string]bool // hosts stores the addresses the daemon is listening on
|
hosts map[string]bool // hosts stores the addresses the daemon is listening on
|
||||||
startupDone chan struct{}
|
startupDone chan struct{}
|
||||||
|
|
||||||
lbAttachmentStore network.LBAttachmentStore
|
attachmentStore network.AttachmentStore
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreHosts stores the addresses the daemon is listening on
|
// 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)
|
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.
|
// 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
|
// GetAttachmentStore returns current attachment store associated with the daemon
|
||||||
func (daemon *Daemon) GetLBAttachmentStore() *network.LBAttachmentStore {
|
func (daemon *Daemon) GetAttachmentStore() *network.AttachmentStore {
|
||||||
return &daemon.lbAttachmentStore
|
return &daemon.attachmentStore
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,7 +370,7 @@ func (daemon *Daemon) createNetwork(create types.NetworkCreateRequest, id string
|
||||||
daemon.LogNetworkEvent(n, "create")
|
daemon.LogNetworkEvent(n, "create")
|
||||||
|
|
||||||
if agent && !n.Info().Ingress() && n.Type() == "overlay" {
|
if agent && !n.Info().Ingress() && n.Type() == "overlay" {
|
||||||
nodeIP, exists := daemon.GetLBAttachmentStore().GetLBIPForNetwork(id)
|
nodeIP, exists := daemon.GetAttachmentStore().GetIPForNetwork(id)
|
||||||
if !exists {
|
if !exists {
|
||||||
return nil, fmt.Errorf("Failed to find a load balancer IP to use for network: %v", id)
|
return nil, fmt.Errorf("Failed to find a load balancer IP to use for network: %v", id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,35 +35,35 @@ type EndpointSettings struct {
|
||||||
IPAMOperational bool
|
IPAMOperational bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// LBAttachmentStore stores the load balancer IP address for a network id.
|
// AttachmentStore stores the load balancer IP address for a network id.
|
||||||
type LBAttachmentStore struct {
|
type AttachmentStore struct {
|
||||||
//key: networkd id
|
//key: networkd id
|
||||||
//value: load balancer ip address
|
//value: load balancer ip address
|
||||||
networkToNodeLBIP map[string]net.IP
|
networkToNodeLBIP map[string]net.IP
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetLBAttachments clears any exsiting load balancer IP to network mapping and
|
// ResetAttachments clears any exsiting load balancer IP to network mapping and
|
||||||
// sets the mapping to the given lbAttachments.
|
// sets the mapping to the given attachments.
|
||||||
func (lbStore *LBAttachmentStore) ResetLBAttachments(lbAttachments map[string]string) error {
|
func (store *AttachmentStore) ResetAttachments(attachments map[string]string) error {
|
||||||
lbStore.ClearLBAttachments()
|
store.ClearAttachments()
|
||||||
for nid, nodeIP := range lbAttachments {
|
for nid, nodeIP := range attachments {
|
||||||
ip, _, err := net.ParseCIDR(nodeIP)
|
ip, _, err := net.ParseCIDR(nodeIP)
|
||||||
if err != nil {
|
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)
|
return errors.Wrapf(err, "Failed to parse load balancer address %s", nodeIP)
|
||||||
}
|
}
|
||||||
lbStore.networkToNodeLBIP[nid] = ip
|
store.networkToNodeLBIP[nid] = ip
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearLBAttachments clears all the mappings of network to load balancer IP Address.
|
// ClearAttachments clears all the mappings of network to load balancer IP Address.
|
||||||
func (lbStore *LBAttachmentStore) ClearLBAttachments() {
|
func (store *AttachmentStore) ClearAttachments() {
|
||||||
lbStore.networkToNodeLBIP = make(map[string]net.IP)
|
store.networkToNodeLBIP = make(map[string]net.IP)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLBIPForNetwork return the load balancer IP address for the given network.
|
// GetIPForNetwork return the load balancer IP address for the given network.
|
||||||
func (lbStore *LBAttachmentStore) GetLBIPForNetwork(networkID string) (net.IP, bool) {
|
func (store *AttachmentStore) GetIPForNetwork(networkID string) (net.IP, bool) {
|
||||||
ip, exists := lbStore.networkToNodeLBIP[networkID]
|
ip, exists := store.networkToNodeLBIP[networkID]
|
||||||
return ip, exists
|
return ip, exists
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue