Browse code

Merge pull request #40340 from thaJeztah/swagger_remove_classic_swarm_node

Swagger/API update "standalone" API fields

Sebastiaan van Stijn authored on 2020/01/24 04:45:46
Showing 4 changed files
... ...
@@ -3931,44 +3931,6 @@ definitions:
3931 3931
           on Windows.
3932 3932
         type: "string"
3933 3933
         example: "/var/lib/docker"
3934
-      SystemStatus:
3935
-        description: |
3936
-          Status information about this node (standalone Swarm API).
3937
-
3938
-          <p><br /></p>
3939
-
3940
-          > **Note**: The information returned in this field is only propagated
3941
-          > by the Swarm standalone API, and is empty (`null`) when using
3942
-          > built-in swarm mode.
3943
-        type: "array"
3944
-        items:
3945
-          type: "array"
3946
-          items:
3947
-            type: "string"
3948
-        example:
3949
-          - ["Role", "primary"]
3950
-          - ["State", "Healthy"]
3951
-          - ["Strategy", "spread"]
3952
-          - ["Filters", "health, port, containerslots, dependency, affinity, constraint, whitelist"]
3953
-          - ["Nodes", "2"]
3954
-          - [" swarm-agent-00", "192.168.99.102:2376"]
3955
-          - ["  └ ID", "5CT6:FBGO:RVGO:CZL4:PB2K:WCYN:2JSV:KSHH:GGFW:QOPG:6J5Q:IOZ2|192.168.99.102:2376"]
3956
-          - ["  └ Status", "Healthy"]
3957
-          - ["  └ Containers", "1 (1 Running, 0 Paused, 0 Stopped)"]
3958
-          - ["  └ Reserved CPUs", "0 / 1"]
3959
-          - ["  └ Reserved Memory", "0 B / 1.021 GiB"]
3960
-          - ["  └ Labels", "kernelversion=4.4.74-boot2docker, operatingsystem=Boot2Docker 17.06.0-ce (TCL 7.2); HEAD : 0672754 - Thu Jun 29 00:06:31 UTC 2017, ostype=linux, provider=virtualbox, storagedriver=aufs"]
3961
-          - ["  └ UpdatedAt", "2017-08-09T10:03:46Z"]
3962
-          - ["  └ ServerVersion", "17.06.0-ce"]
3963
-          - [" swarm-manager", "192.168.99.101:2376"]
3964
-          - ["  └ ID", "TAMD:7LL3:SEF7:LW2W:4Q2X:WVFH:RTXX:JSYS:XY2P:JEHL:ZMJK:JGIW|192.168.99.101:2376"]
3965
-          - ["  └ Status", "Healthy"]
3966
-          - ["  └ Containers", "2 (2 Running, 0 Paused, 0 Stopped)"]
3967
-          - ["  └ Reserved CPUs", "0 / 1"]
3968
-          - ["  └ Reserved Memory", "0 B / 1.021 GiB"]
3969
-          - ["  └ Labels", "kernelversion=4.4.74-boot2docker, operatingsystem=Boot2Docker 17.06.0-ce (TCL 7.2); HEAD : 0672754 - Thu Jun 29 00:06:31 UTC 2017, ostype=linux, provider=virtualbox, storagedriver=aufs"]
3970
-          - ["  └ UpdatedAt", "2017-08-09T10:04:11Z"]
3971
-          - ["  └ ServerVersion", "17.06.0-ce"]
3972 3934
       Plugins:
3973 3935
         $ref: "#/definitions/PluginsInfo"
3974 3936
       MemoryLimit:
... ...
@@ -5112,9 +5074,6 @@ paths:
5112 5112
                 type: "string"
5113 5113
               LogPath:
5114 5114
                 type: "string"
5115
-              Node:
5116
-                description: "TODO"
5117
-                type: "object"
5118 5115
               Name:
5119 5116
                 type: "string"
5120 5117
               RestartCount:
... ...
@@ -154,7 +154,7 @@ type Info struct {
154 154
 	Images             int
155 155
 	Driver             string
156 156
 	DriverStatus       [][2]string
157
-	SystemStatus       [][2]string
157
+	SystemStatus       [][2]string `json:",omitempty"` // SystemStatus is only propagated by the Swarm standalone API
158 158
 	Plugins            PluginsInfo
159 159
 	MemoryLimit        bool
160 160
 	SwapLimit          bool
... ...
@@ -318,7 +318,7 @@ type ContainerState struct {
318 318
 }
319 319
 
320 320
 // ContainerNode stores information about the node that a container
321
-// is running on.  It's only available in Docker Swarm
321
+// is running on.  It's only used by the Docker Swarm standalone API
322 322
 type ContainerNode struct {
323 323
 	ID        string
324 324
 	IPAddress string `json:"IP"`
... ...
@@ -342,7 +342,7 @@ type ContainerJSONBase struct {
342 342
 	HostnamePath    string
343 343
 	HostsPath       string
344 344
 	LogPath         string
345
-	Node            *ContainerNode `json:",omitempty"`
345
+	Node            *ContainerNode `json:",omitempty"` // Node is only propagated by Docker Swarm standalone API
346 346
 	Name            string
347 347
 	RestartCount    int
348 348
 	Driver          string
... ...
@@ -88,6 +88,8 @@ func TestContainerInspect(t *testing.T) {
88 88
 	}
89 89
 }
90 90
 
91
+// TestContainerInspectNode tests that the "Node" field is included in the "inspect"
92
+// output. This information is only present when connected to a Swarm standalone API.
91 93
 func TestContainerInspectNode(t *testing.T) {
92 94
 	client := &Client{
93 95
 		client: newMockClient(func(req *http.Request) (*http.Response, error) {
... ...
@@ -31,6 +31,9 @@ keywords: "API, Docker, rcli, REST, documentation"
31 31
 * `GET /info` now  returns an `OSVersion` field, containing the operating system's
32 32
   version. This change is not versioned, and affects all API versions if the daemon
33 33
   has this patch.
34
+* `GET /info` no longer returns the `SystemStatus` field if it does not have a
35
+  value set. This change is not versioned, and affects all API versions if the
36
+  daemon has this patch.
34 37
 * `GET /services` now accepts query parameter `status`. When set `true`,
35 38
   services returned will include `ServiceStatus`, which provides Desired,
36 39
   Running, and Completed task counts for the service.