Sfoglia il codice sorgente

Move support for sysctl options in services to API v1.40

This feature was added in 14da20f5e79fc322208ec49edce34e0b575d8973,
and was merged after API v1.39 shipped as part of the Docker 18.09
release candidates.

This commit moves the feature to the correct API version.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 6 anni fa
parent
commit
cb9d2cb71b

+ 4 - 4
api/server/router/swarm/cluster_routes.go

@@ -186,10 +186,10 @@ func (sr *swarmRouter) createService(ctx context.Context, w http.ResponseWriter,
 		if versions.LessThan(cliVersion, "1.30") {
 		if versions.LessThan(cliVersion, "1.30") {
 			queryRegistry = true
 			queryRegistry = true
 		}
 		}
-		if versions.LessThan(cliVersion, "1.39") {
+		if versions.LessThan(cliVersion, "1.40") {
 			if service.TaskTemplate.ContainerSpec != nil {
 			if service.TaskTemplate.ContainerSpec != nil {
 				// Sysctls for docker swarm services weren't supported before
 				// Sysctls for docker swarm services weren't supported before
-				// API version 1.39
+				// API version 1.40
 				service.TaskTemplate.ContainerSpec.Sysctls = nil
 				service.TaskTemplate.ContainerSpec.Sysctls = nil
 			}
 			}
 		}
 		}
@@ -229,10 +229,10 @@ func (sr *swarmRouter) updateService(ctx context.Context, w http.ResponseWriter,
 		if versions.LessThan(cliVersion, "1.30") {
 		if versions.LessThan(cliVersion, "1.30") {
 			queryRegistry = true
 			queryRegistry = true
 		}
 		}
-		if versions.LessThan(cliVersion, "1.39") {
+		if versions.LessThan(cliVersion, "1.40") {
 			if service.TaskTemplate.ContainerSpec != nil {
 			if service.TaskTemplate.ContainerSpec != nil {
 				// Sysctls for docker swarm services weren't supported before
 				// Sysctls for docker swarm services weren't supported before
-				// API version 1.39
+				// API version 1.40
 				service.TaskTemplate.ContainerSpec.Sysctls = nil
 				service.TaskTemplate.ContainerSpec.Sysctls = nil
 			}
 			}
 		}
 		}

+ 6 - 6
docs/api/version-history.md

@@ -17,6 +17,12 @@ keywords: "API, Docker, rcli, REST, documentation"
 
 
 [Docker Engine API v1.40](https://docs.docker.com/engine/api/v1.40/) documentation
 [Docker Engine API v1.40](https://docs.docker.com/engine/api/v1.40/) documentation
 
 
+* `GET /services` now returns `Sysctls` as part of the `ContainerSpec`.
+* `GET /services/{id}` now returns `Sysctls` as part of the `ContainerSpec`.
+* `POST /services/create` now accepts `Sysctls` as part of the `ContainerSpec`.
+* `POST /services/{id}/update` now accepts `Sysctls` as part of the `ContainerSpec`.
+* `GET /tasks` now  returns `Sysctls` as part of the `ContainerSpec`.
+* `GET /tasks/{id}` now  returns `Sysctls` as part of the `ContainerSpec`.
 
 
 ## V1.39 API changes
 ## V1.39 API changes
 
 
@@ -35,12 +41,6 @@ keywords: "API, Docker, rcli, REST, documentation"
   on the node.label. The format of the label filter is `node.label=<key>`/`node.label=<key>=<value>`
   on the node.label. The format of the label filter is `node.label=<key>`/`node.label=<key>=<value>`
   to return those with the specified labels, or `node.label!=<key>`/`node.label!=<key>=<value>`
   to return those with the specified labels, or `node.label!=<key>`/`node.label!=<key>=<value>`
   to return those without the specified labels.
   to return those without the specified labels.
-* `GET /services` now returns `Sysctls` as part of the `ContainerSpec`.
-* `GET /services/{id}` now returns `Sysctls` as part of the `ContainerSpec`.
-* `POST /services/create` now accepts `Sysctls` as part of the `ContainerSpec`.
-* `POST /services/{id}/update` now accepts `Sysctls` as part of the `ContainerSpec`.
-* `GET /tasks` now  returns `Sysctls` as part of the `ContainerSpec`.
-* `GET /tasks/{id}` now  returns `Sysctls` as part of the `ContainerSpec`.
 
 
 ## V1.38 API changes
 ## V1.38 API changes
 
 

+ 2 - 2
integration/service/create_test.go

@@ -339,8 +339,8 @@ func TestCreateServiceConfigFileMode(t *testing.T) {
 // anything up in the test environment
 // anything up in the test environment
 func TestCreateServiceSysctls(t *testing.T) {
 func TestCreateServiceSysctls(t *testing.T) {
 	skip.If(
 	skip.If(
-		t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.39"),
-		"setting service sysctls is unsupported before api v1.39",
+		t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"),
+		"setting service sysctls is unsupported before api v1.40",
 	)
 	)
 
 
 	defer setupTest(t)()
 	defer setupTest(t)()