Option to output node labels in node ls format
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Description
The docker node ls command takes a --format option to customize the output. My nodes are labeled with metadata like the availability zone and node group name. It would be really useful to be able to output labels when listing nodes.
Steps to reproduce the issue:
- Attempt to output a list of nodes with foo labels.
docker node ls --format 'table {{ .ID }}\t{{ .Label.foo }}'
Describe the results you received:
It is not possible to output all labels, or a specific label.
Template parsing error: template: :1:19: executing "" at <.Label.foo>: can't evaluate field Label in type *node.nodeContext
Describe the results you expected:
An option to output one or more labels.
Additional information you deem important (e.g. issue happens only occasionally):
It is possible to filter nodes by label.
docker node ls --filter "label=foo"
Output of docker version:
Client: Docker Engine - Community
Version: 19.03.0-rc2
API version: 1.39 (downgraded from 1.40)
Go version: go1.12.5
Git commit: f97efcc
Built: Wed Jun 5 01:37:53 2019
OS/Arch: darwin/amd64
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 18.09.6
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 481bc77
Built: Sat May 4 02:02:43 2019
OS/Arch: linux/amd64
Experimental: false
Output of docker info:
N/A
Additional environment details (AWS, VirtualBox, physical, etc.):
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the docker node ls command and trace how its --format template context is built. Add support for rendering one or more node labels, then verify that {{ .Label.foo }} produces the requested label in formatted output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100