docker / docker/docker-py

Feature Request: manage labels on nodes

Open
#1,225 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

group/api-upgrade kind/feature-request
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.