浏览代码

Merge pull request #40614 from thaJeztah/more_deprecating

Add warnings for deprecated "cluster" functions, and deprecate API fields
Akihiro Suda 5 年之前
父节点
当前提交
5ddbe511a1
共有 5 个文件被更改,包括 21 次插入6 次删除
  1. 2 2
      api/swagger.yaml
  2. 2 2
      api/types/types.go
  3. 3 0
      daemon/config/config.go
  4. 11 2
      daemon/info.go
  5. 3 0
      docs/api/version-history.md

+ 2 - 2
api/swagger.yaml

@@ -4186,7 +4186,7 @@ definitions:
 
 
           <p><br /></p>
           <p><br /></p>
 
 
-          > **Note**: This field is only propagated when using standalone Swarm
+          > **Deprecated**: This field is only propagated when using standalone Swarm
           > mode, and overlay networking using an external k/v store. Overlay
           > mode, and overlay networking using an external k/v store. Overlay
           > networks with Swarm mode enabled use the built-in raft store, and
           > networks with Swarm mode enabled use the built-in raft store, and
           > this field will be empty.
           > this field will be empty.
@@ -4200,7 +4200,7 @@ definitions:
 
 
           <p><br /></p>
           <p><br /></p>
 
 
-          > **Note**: This field is only propagated when using standalone Swarm
+          > **Deprecated**: This field is only propagated when using standalone Swarm
           > mode, and overlay networking using an external k/v store. Overlay
           > mode, and overlay networking using an external k/v store. Overlay
           > networks with Swarm mode enabled use the built-in raft store, and
           > networks with Swarm mode enabled use the built-in raft store, and
           > this field will be empty.
           > this field will be empty.

+ 2 - 2
api/types/types.go

@@ -194,8 +194,8 @@ type Info struct {
 	Labels             []string
 	Labels             []string
 	ExperimentalBuild  bool
 	ExperimentalBuild  bool
 	ServerVersion      string
 	ServerVersion      string
-	ClusterStore       string
-	ClusterAdvertise   string
+	ClusterStore       string `json:",omitempty"` // Deprecated: host-discovery and overlay networks with external k/v stores are deprecated
+	ClusterAdvertise   string `json:",omitempty"` // Deprecated: host-discovery and overlay networks with external k/v stores are deprecated
 	Runtimes           map[string]Runtime
 	Runtimes           map[string]Runtime
 	DefaultRuntime     string
 	DefaultRuntime     string
 	Swarm              swarm.Info
 	Swarm              swarm.Info

+ 3 - 0
daemon/config/config.go

@@ -159,15 +159,18 @@ type CommonConfig struct {
 	// ClusterStore is the storage backend used for the cluster information. It is used by both
 	// ClusterStore is the storage backend used for the cluster information. It is used by both
 	// multihost networking (to store networks and endpoints information) and by the node discovery
 	// multihost networking (to store networks and endpoints information) and by the node discovery
 	// mechanism.
 	// mechanism.
+	// Deprecated: host-discovery and overlay networks with external k/v stores are deprecated
 	ClusterStore string `json:"cluster-store,omitempty"`
 	ClusterStore string `json:"cluster-store,omitempty"`
 
 
 	// ClusterOpts is used to pass options to the discovery package for tuning libkv settings, such
 	// ClusterOpts is used to pass options to the discovery package for tuning libkv settings, such
 	// as TLS configuration settings.
 	// as TLS configuration settings.
+	// Deprecated: host-discovery and overlay networks with external k/v stores are deprecated
 	ClusterOpts map[string]string `json:"cluster-store-opts,omitempty"`
 	ClusterOpts map[string]string `json:"cluster-store-opts,omitempty"`
 
 
 	// ClusterAdvertise is the network endpoint that the Engine advertises for the purpose of node
 	// ClusterAdvertise is the network endpoint that the Engine advertises for the purpose of node
 	// discovery. This should be a 'host:port' combination on which that daemon instance is
 	// discovery. This should be a 'host:port' combination on which that daemon instance is
 	// reachable by other hosts.
 	// reachable by other hosts.
+	// Deprecated: host-discovery and overlay networks with external k/v stores are deprecated
 	ClusterAdvertise string `json:"cluster-advertise,omitempty"`
 	ClusterAdvertise string `json:"cluster-advertise,omitempty"`
 
 
 	// MaxConcurrentDownloads is the maximum number of downloads that
 	// MaxConcurrentDownloads is the maximum number of downloads that

+ 11 - 2
daemon/info.go

@@ -63,8 +63,6 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
 		Labels:             daemon.configStore.Labels,
 		Labels:             daemon.configStore.Labels,
 		ExperimentalBuild:  daemon.configStore.Experimental,
 		ExperimentalBuild:  daemon.configStore.Experimental,
 		ServerVersion:      dockerversion.Version,
 		ServerVersion:      dockerversion.Version,
-		ClusterStore:       daemon.configStore.ClusterStore,
-		ClusterAdvertise:   daemon.configStore.ClusterAdvertise,
 		HTTPProxy:          maskCredentials(getEnvAny("HTTP_PROXY", "http_proxy")),
 		HTTPProxy:          maskCredentials(getEnvAny("HTTP_PROXY", "http_proxy")),
 		HTTPSProxy:         maskCredentials(getEnvAny("HTTPS_PROXY", "https_proxy")),
 		HTTPSProxy:         maskCredentials(getEnvAny("HTTPS_PROXY", "https_proxy")),
 		NoProxy:            getEnvAny("NO_PROXY", "no_proxy"),
 		NoProxy:            getEnvAny("NO_PROXY", "no_proxy"),
@@ -72,6 +70,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
 		Isolation:          daemon.defaultIsolation,
 		Isolation:          daemon.defaultIsolation,
 	}
 	}
 
 
+	daemon.fillClusterInfo(v)
 	daemon.fillAPIInfo(v)
 	daemon.fillAPIInfo(v)
 	// Retrieve platform specific info
 	// Retrieve platform specific info
 	daemon.fillPlatformInfo(v, sysInfo)
 	daemon.fillPlatformInfo(v, sysInfo)
@@ -127,6 +126,16 @@ func (daemon *Daemon) SystemVersion() types.Version {
 	return v
 	return v
 }
 }
 
 
+func (daemon *Daemon) fillClusterInfo(v *types.Info) {
+	v.ClusterAdvertise = daemon.configStore.ClusterAdvertise
+	v.ClusterStore = daemon.configStore.ClusterStore
+
+	if v.ClusterAdvertise != "" || v.ClusterStore != "" {
+		v.Warnings = append(v.Warnings, `WARNING: node discovery and overlay networks with an external k/v store (cluster-advertise,
+         cluster-store, cluster-store-opt) are deprecated and will be removed in a future release.`)
+	}
+}
+
 func (daemon *Daemon) fillDriverInfo(v *types.Info) {
 func (daemon *Daemon) fillDriverInfo(v *types.Info) {
 	var ds [][2]string
 	var ds [][2]string
 	drivers := ""
 	drivers := ""

+ 3 - 0
docs/api/version-history.md

@@ -17,6 +17,9 @@ keywords: "API, Docker, rcli, REST, documentation"
 
 
 [Docker Engine API v1.41](https://docs.docker.com/engine/api/v1.41/) documentation
 [Docker Engine API v1.41](https://docs.docker.com/engine/api/v1.41/) documentation
 
 
+* The `ClusterStore` and `ClusterAdvertise` fields in `GET /info` are deprecated
+  and are now omitted if they contain an empty value. This change is not versioned,
+  and affects all API versions if the daemon has this patch.
 * The `filter` (singular) query parameter, which was deprecated in favor of the
 * The `filter` (singular) query parameter, which was deprecated in favor of the
   `filters` option in Docker 1.13, has now been removed from the `GET /images/json`
   `filters` option in Docker 1.13, has now been removed from the `GET /images/json`
   endpoint. The parameter remains available when using API version 1.40 or below.
   endpoint. The parameter remains available when using API version 1.40 or below.