1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

libnetwork: remove more config bits related to external k/v stores

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-12-22 10:42:13 +01:00
parent 745ba3ecbc
commit 7b692a421b
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
4 changed files with 3 additions and 34 deletions

View file

@ -25,7 +25,6 @@ const (
// Config encapsulates configurations of various Libnetwork components // Config encapsulates configurations of various Libnetwork components
type Config struct { type Config struct {
Daemon DaemonCfg Daemon DaemonCfg
Cluster ClusterCfg
Scopes map[string]*datastore.ScopeCfg Scopes map[string]*datastore.ScopeCfg
ActiveSandboxes map[string]interface{} ActiveSandboxes map[string]interface{}
PluginGetter plugingetter.PluginGetter PluginGetter plugingetter.PluginGetter
@ -46,13 +45,6 @@ type DaemonCfg struct {
DefaultAddressPool []*ipamutils.NetworkToSplit DefaultAddressPool []*ipamutils.NetworkToSplit
} }
// ClusterCfg represents cluster configuration
type ClusterCfg struct {
Address string
Discovery string
Heartbeat uint64
}
// LoadDefaultScopes loads default scope configs for scopes which // LoadDefaultScopes loads default scope configs for scopes which
// doesn't have explicit user specified configs. // doesn't have explicit user specified configs.
func (c *Config) LoadDefaultScopes(dataDir string) { func (c *Config) LoadDefaultScopes(dataDir string) {

View file

@ -536,16 +536,6 @@ func (c *controller) BuiltinIPAMDrivers() []string {
return drivers return drivers
} }
func (c *controller) clusterHostID() string {
c.Lock()
defer c.Unlock()
if c.cfg == nil || c.cfg.Cluster.Address == "" {
return ""
}
addr := strings.Split(c.cfg.Cluster.Address, ":")
return addr[0]
}
func (c *controller) processNodeDiscovery(nodes []net.IP, add bool) { func (c *controller) processNodeDiscovery(nodes []net.IP, add bool) {
c.drvRegistry.WalkDrivers(func(name string, driver driverapi.Driver, capability driverapi.Capability) bool { c.drvRegistry.WalkDrivers(func(name string, driver driverapi.Driver, capability driverapi.Capability) bool {
c.pushNodeDiscovery(driver, capability, nodes, add) c.pushNodeDiscovery(driver, capability, nodes, add)
@ -555,15 +545,9 @@ func (c *controller) processNodeDiscovery(nodes []net.IP, add bool) {
func (c *controller) pushNodeDiscovery(d driverapi.Driver, cap driverapi.Capability, nodes []net.IP, add bool) { func (c *controller) pushNodeDiscovery(d driverapi.Driver, cap driverapi.Capability, nodes []net.IP, add bool) {
var self net.IP var self net.IP
if c.cfg != nil { // try swarm-mode config
addr := strings.Split(c.cfg.Cluster.Address, ":") if agent := c.getAgent(); agent != nil {
self = net.ParseIP(addr[0]) self = net.ParseIP(agent.advertiseAddr)
// if external kvstore is not configured, try swarm-mode config
if self == nil {
if agent := c.getAgent(); agent != nil {
self = net.ParseIP(agent.advertiseAddr)
}
}
} }
if d == nil || cap.ConnectivityScope != datastore.GlobalScope || nodes == nil { if d == nil || cap.ConnectivityScope != datastore.GlobalScope || nodes == nil {

View file

@ -54,7 +54,6 @@ type endpoint struct {
iface *endpointInterface iface *endpointInterface
joinInfo *endpointJoinInfo joinInfo *endpointJoinInfo
sandboxID string sandboxID string
locator string
exposedPorts []types.TransportPort exposedPorts []types.TransportPort
anonymous bool anonymous bool
disableResolution bool disableResolution bool
@ -90,7 +89,6 @@ func (ep *endpoint) MarshalJSON() ([]byte, error) {
epMap["generic"] = ep.generic epMap["generic"] = ep.generic
} }
epMap["sandbox"] = ep.sandboxID epMap["sandbox"] = ep.sandboxID
epMap["locator"] = ep.locator
epMap["anonymous"] = ep.anonymous epMap["anonymous"] = ep.anonymous
epMap["disableResolution"] = ep.disableResolution epMap["disableResolution"] = ep.disableResolution
epMap["myAliases"] = ep.myAliases epMap["myAliases"] = ep.myAliases
@ -190,9 +188,6 @@ func (ep *endpoint) UnmarshalJSON(b []byte) (err error) {
if v, ok := epMap["disableResolution"]; ok { if v, ok := epMap["disableResolution"]; ok {
ep.disableResolution = v.(bool) ep.disableResolution = v.(bool)
} }
if l, ok := epMap["locator"]; ok {
ep.locator = l.(string)
}
if sn, ok := epMap["svcName"]; ok { if sn, ok := epMap["svcName"]; ok {
ep.svcName = sn.(string) ep.svcName = sn.(string)
@ -239,7 +234,6 @@ func (ep *endpoint) CopyTo(o datastore.KVObject) error {
dstEp.name = ep.name dstEp.name = ep.name
dstEp.id = ep.id dstEp.id = ep.id
dstEp.sandboxID = ep.sandboxID dstEp.sandboxID = ep.sandboxID
dstEp.locator = ep.locator
dstEp.dbIndex = ep.dbIndex dstEp.dbIndex = ep.dbIndex
dstEp.dbExists = ep.dbExists dstEp.dbExists = ep.dbExists
dstEp.anonymous = ep.anonymous dstEp.anonymous = ep.anonymous

View file

@ -1175,7 +1175,6 @@ func (n *network) createEndpoint(name string, options ...EndpointOption) (Endpoi
// Initialize ep.network with a possibly stale copy of n. We need this to get network from // Initialize ep.network with a possibly stale copy of n. We need this to get network from
// store. But once we get it from store we will have the most uptodate copy possibly. // store. But once we get it from store we will have the most uptodate copy possibly.
ep.network = n ep.network = n
ep.locator = n.getController().clusterHostID()
ep.network, err = ep.getNetworkFromStore() ep.network, err = ep.getNetworkFromStore()
if err != nil { if err != nil {
logrus.Errorf("failed to get network during CreateEndpoint: %v", err) logrus.Errorf("failed to get network during CreateEndpoint: %v", err)