Node labels and selector targeting
Nodes carry an optional operator-managed label map. Rollouts can target an explicit node list or a label selector, which lets you describe intent ("all production edge nodes") instead of maintaining node ids.
Use when: you need to roll out configuration to a changing subset of nodes, or you want the console and API to describe targets by environment and tier.
Semantics you must know
- Labels are durable Hub state, not agent-local config. Agent re-registrations and Hub restarts never change them.
PUT /api/v1/nodes/{node_id}/labelsperforms a full replacement; it does not merge. Send the complete map every time.- At most 16 labels, each key/value 1–63 characters.
- Every replacement is audited with scalar metadata.
- A selector resolves once, at creation or approval-submission time. Nodes that gain the label afterwards are not picked up; create a new rollout to include them. Under the approval policy the pending request pins the resolved node set, so approving later cannot swap targets.
- Matching reads durable node records, not the live registration map: a drained or stale node that still carries the label stays selected, as does a node that has not re-registered after a Hub restart.
- An empty resolution (
no_matching_nodes) rejects the request outright.
Prerequisites
manage_nodesfor label replacement;manage_rolloutsfor rollout creation.- The Hub has durable storage (labels and selector resolution are persisted).
- A naming convention agreed with the fleet: for example
env(prod,staging),tier(edge,core),region,pool.
Steps
-
Inspect current labels for a node:
curl -s -H "Authorization: Bearer $TOKEN" \
http://hub:8080/api/v1/nodes | jq '.items[] | {node_id, labels}' -
Replace a node's labels (full map):
curl -s -X PUT -H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-d '{"labels":{"env":"prod","tier":"edge"}}' \
http://hub:8080/api/v1/nodes/node-a/labels -
Create a rollout with a selector. In the console, choose "label selector" and enter the pairs; through the API, send the selector in place of
node_ids. The response shows the resolved node set. -
Review the resolved set before applying. An empty set is rejected; a smaller set than expected usually means a typo or a node that has not been labelled yet.
-
If
approval_requiredis on, submit for approval; the approver sees the pinned node set.
Verification
GET /api/v1/rollouts/{id}lists the resolved nodes and their convergence.- The audit stream contains the label replacement (
node.labelsor the rollout's actor-attributed record). - A test rollout to a single labelled node converges before you widen the selector.
Rollback
- Relabel and create a new rollout. Selectors are evaluated at creation time, so a running rollout keeps its pinned set even if you change labels.
- To stop a rollout, use the rollout action (cancel/rollback) rather than relabelling nodes — relabelling does not retract an in-flight batch.
- Removing labels is a full replacement with the remaining map (
{}clears all labels); it affects future selectors, not existing rollouts.
Failure modes
| Symptom | Cause | Fix |
|---|---|---|
no_matching_nodes | Selector matches no durable node | Check label spelling and that nodes are labelled. |
| Fewer nodes than expected | Node not labelled or re-registered without labels | Label it, then create a new rollout. |
| Rollout targets a drained node | Matching reads durable records by design | Drain state does not remove labels; use an explicit list or wait. |
| Label update had no effect on a rollout | Selector resolved earlier | Create a new rollout. |