Browse Source

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 năm trước cách đây
mục cha
commit
7b692a421b
4 tập tin đã thay đổi với 3 bổ sung34 xóa
  1. 0 8
      libnetwork/config/config.go
  2. 3 19
      libnetwork/controller.go
  3. 0 6
      libnetwork/endpoint.go
  4. 0 1
      libnetwork/network.go

+ 0 - 8
libnetwork/config/config.go

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

+ 3 - 19
libnetwork/controller.go

@@ -536,16 +536,6 @@ func (c *controller) BuiltinIPAMDrivers() []string {
 	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) {
 	c.drvRegistry.WalkDrivers(func(name string, driver driverapi.Driver, capability driverapi.Capability) bool {
 		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) {
 	var self net.IP
-	if c.cfg != nil {
-		addr := strings.Split(c.cfg.Cluster.Address, ":")
-		self = net.ParseIP(addr[0])
-		// if external kvstore is not configured, try swarm-mode config
-		if self == nil {
-			if agent := c.getAgent(); agent != nil {
-				self = net.ParseIP(agent.advertiseAddr)
-			}
-		}
+	// try swarm-mode config
+	if agent := c.getAgent(); agent != nil {
+		self = net.ParseIP(agent.advertiseAddr)
 	}
 
 	if d == nil || cap.ConnectivityScope != datastore.GlobalScope || nodes == nil {

+ 0 - 6
libnetwork/endpoint.go

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

+ 0 - 1
libnetwork/network.go

@@ -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
 	// store. But once we get it from store we will have the most uptodate copy possibly.
 	ep.network = n
-	ep.locator = n.getController().clusterHostID()
 	ep.network, err = ep.getNetworkFromStore()
 	if err != nil {
 		logrus.Errorf("failed to get network during CreateEndpoint: %v", err)