Feature Request: manage labels on nodes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
I want to manage the labels on nodes. I can use client.nodes() or client.inspect_node(id) to get the current configuration, but I would like to be able to update the labels via Python.
The command line that I can run to manually add labels is
docker node update --label-add my.key="my value" 269...mynodeid...gd
This is a snippet of the output from the client.nodes() output.
'Spec': { 'Availability': 'active',
'Labels': {'my.key': 'my value'},
'Role': 'worker'},
The closest thing in the code now is in the swarm.py
The API docs show it in the nodes section. I can add a pull request. Would you prefer that I add an update_node function to the swarm.py or refactor to pull the node related changes out of swarm.py and put it into a nodes.py file?
I am thinking something in the style of the create_volumes function that takes named parameters, converts them to json and posts to the nodes/{id} url. I would also like to promote nodes between worker and manager. I think that could Any thoughts on that?
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 with docker/api/swarm.py and the Docker Engine API v1.24 update-a-node documentation. Compare the existing client.nodes() and client.inspect_node(id) behavior with the nodes/{id} update endpoint, then determine the intended scope for label updates and worker/manager promotion. Done means the Python client supports the agreed node updates with coverage for the requested behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100