Skip to content

Assign labels to objects

An Assignment binds a Label Definition's key to a value on a concrete object. plexctl label object wraps /v1/objects/{kind}/{id}/labels; plexctl label selector preview tests selector expressions.

Prerequisites

Steps

Set and list assignments

shell
plexctl label object set node:<node-uuid> --definition-id <definition-uuid> --value gold
# OBJECT_KIND  OBJECT_ID  QUALIFIED_KEY  VALUE  ASSIGNED_BY
# node         …          tier           gold   …
plexctl label object list node:<node-uuid>
# OBJECT_KIND  OBJECT_ID  QUALIFIED_KEY  VALUE  ASSIGNED_BY
# node         …          tier           gold   …

--value is validated against the Definition's value schema.

Remove an assignment

shell
plexctl label object delete node:<node-uuid> --qualified-key <qualified-key> --yes

delete is destructive and requires the persistent --yes flag.

Preview a selector

shell
plexctl label selector preview --selector 'tier in (gold, silver) && env == prod'
# OP  KEY   VALUE  VALUES
# in  tier  -      gold, silver
# ==  env   prod   -

preview never raises — it renders the parsed AST, or an ERROR row per parse error with the offending position.

Verification

shell
plexctl label object list node:<node-uuid> --output json | jq
# [
#   {
#     "object_kind": "node",
#     "qualified_key": "tier",
#     "value": "gold",
#     …
#   }
# ]

See also