Skip to content

swagger: define ContainerNode for GET /containers/{ID}/json#39821

Closed
grooverdan wants to merge 1 commit intomoby:masterfrom
grooverdan:containers_json_with_node
Closed

swagger: define ContainerNode for GET /containers/{ID}/json#39821
grooverdan wants to merge 1 commit intomoby:masterfrom
grooverdan:containers_json_with_node

Conversation

@grooverdan
Copy link
Copy Markdown
Contributor

Define ContainerNode in swagger for GET /containers/{ID}/json

- A picture of a cute animal (not mandatory but encouraged)

image

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! Sorry for the long delay; I left some suggestions / comments inline below

Comment thread api/swagger.yaml
type: "string"
IP:
description: "IP Address"
type: "string"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a x-go-name field (possibly we can generate the Go type from the swagger, but I think that needs a bug fix in the swagger generator; still can't hurt to have it in place already)

        type: "string"
        x-go-name: "IPAddress"

Comment thread api/swagger.yaml

ContainerNode:
type: "object"
description: "Node container is running on in Swarm"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use the description that's currently used on the type defined in Go?

moby/api/types/types.go

Lines 320 to 322 in 39e6def

// ContainerNode stores information about the node that a container
// is running on. It's only available in Docker Swarm
type ContainerNode struct {

We should probably change Docker Swarm to Docker Classic Swarm to prevent confusion 😓

    description: |
      ContainerNode stores information about the node that a container
      is running on.  It's only available in Docker Classic Swarm

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So; the trouble is a bit with this struct, is that the Docker Engine itself will never propagate it; it's only used for Classic Swarm (which augments the Docker API); https://github.com/docker/swarm/blob/38c89321393f53deeaf3f69af596121740f06545/cluster/engine.go#L460-L468

So from that perspective, I'm a bit on the fence on this one. On the other hand; it's defined in the API, so 🤷‍♂

@thaJeztah
Copy link
Copy Markdown
Member

ping @dperny @cpuguy83 WDYT?

@grooverdan
Copy link
Copy Markdown
Contributor Author

I'm going to assume shortly that no other feedback is coming. Last chance @cpuguy83 and @dperny.

Thanks for the review @thaJeztah, that all seems quite doable.

@cpuguy83
Copy link
Copy Markdown
Member

I don't think I understand why we would add classic swarm api here.

@grooverdan
Copy link
Copy Markdown
Contributor Author

Is there a separate place the Classic Swarm API is documented? The reason for an API is to provide a decoupling of components and that can only happen if documented. I'm only filling out a TODO in containers/{id}/json documentation here so its a little more complete for those that wish to consume the API.

@cpuguy83
Copy link
Copy Markdown
Member

cpuguy83 commented Nov 5, 2019

Classic swarm API docs are here: https://docs.docker.com/swarm/swarm-api/
However it's not really got a spec.

@thaJeztah
Copy link
Copy Markdown
Member

With this option already documented in https://docs.docker.com/swarm/swarm-api/, perhaps the better option would be to remove the Node field from the swagger file here?

Let me open a PR to do that

@thaJeztah
Copy link
Copy Markdown
Member

opened #40340

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants