Skip to content

Feature Request: manage labels on nodes #1225

Open
@nathannis

Description

@nathannis

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions