Skip to content

Commit 76cca88

Browse files
authored
docs: refine workflow-label documentation (#1308)
refine workflow-label documentation
1 parent 1da31e1 commit 76cca88

7 files changed

Lines changed: 239 additions & 83 deletions

File tree

docs/deployment_guide/advanced_config/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ This section provides additional advanced configurations to customize and optimi
7070

7171
Grant shared cloud bucket access to every workflow in a pool, so team members don't supply credentials per workflow.
7272

73+
.. grid-item-card:: :octicon:`tag` Workflow Labels
74+
:link: ./workflow_labels
75+
:link-type: doc
76+
77+
Require and constrain workflow label keys, and namespace the label keys stamped onto task pods.
78+
7379
.. grid-item-card:: :octicon:`plug` MCP
7480
:link: ./mcp
7581
:link-type: doc
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
..
2+
SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
16+
SPDX-License-Identifier: Apache-2.0
17+
18+
19+
.. _workflow_labels_config:
20+
21+
=======================================================
22+
Workflow Labels
23+
=======================================================
24+
25+
Users attach labels to a workflow to record who owns it and what it is for. Label syntax is checked on every submission even when nothing is configured here; a policy adds requirements on top, so you can decide which keys must be present and which values are accepted.
26+
27+
See :ref:`workflow_spec_labels` for how users set labels, and :ref:`workflow_submission` for the CLI flags and list filters. Field definitions are in :ref:`workflow_config`.
28+
29+
30+
Why Configure a Policy?
31+
=======================
32+
33+
✓ **Attribute usage**
34+
Require a key such as ``team`` or ``cost-center`` so every workflow can be traced back to an owner.
35+
36+
✓ **Keep values consistent**
37+
An allow-list rejects typos and near-duplicates, which keeps reports and dashboards aligned.
38+
39+
✓ **Roll out gradually**
40+
Warn before you enforce, so users see what to change while their submissions still succeed.
41+
42+
43+
Enforcement Modes
44+
=================
45+
46+
Each entry in ``policy`` controls one key independently.
47+
48+
.. list-table::
49+
:header-rows: 1
50+
:widths: 15 85
51+
52+
* - **Mode**
53+
- **Behavior when the key is missing, or its value is outside a non-empty allow-list**
54+
* - ``"off"``
55+
- Accepted, with no warning. Same as omitting the key from ``policy``.
56+
* - ``warn``
57+
- Accepted, and the submit response carries a warning.
58+
* - ``enforce``
59+
- Rejected. No workflow row and no stored specification are created.
60+
61+
.. code-block:: yaml
62+
63+
labels_config:
64+
policy:
65+
- key: team
66+
allow_list:
67+
- robotics
68+
- simulation
69+
enforcement: warn
70+
- key: cost-center
71+
allow_list: []
72+
enforcement: enforce
73+
74+
An empty ``allow_list`` accepts any well-formed value, so the key becomes required without constraining what it holds.
75+
76+
.. note::
77+
78+
Quote ``"off"``. Unquoted YAML ``off`` parses as boolean false.
79+
80+
The same policy applies to new submissions, resubmission by ID, restart, and validation-only requests. Warnings are recomputed from the stored labels and the current policy, so a workflow always shows the warnings its policy would produce today, including after it completes.
81+
82+
83+
Rolling Out a Requirement
84+
=========================
85+
86+
.. grid:: 3
87+
:gutter: 2
88+
89+
.. grid-item-card::
90+
:class-header: sd-bg-info sd-text-white
91+
92+
**1. Announce** 📣
93+
^^^
94+
95+
Add the key with ``enforcement: warn``
96+
97+
+++
98+
99+
Submissions succeed; users see what to add
100+
101+
.. grid-item-card::
102+
:class-header: sd-bg-warning sd-text-white
103+
104+
**2. Watch** 📊
105+
^^^
106+
107+
Check the :ref:`validation metrics <workflow_labels_metrics>`
108+
109+
+++
110+
111+
See who is still missing the key before it starts rejecting
112+
113+
.. grid-item-card::
114+
:class-header: sd-bg-success sd-text-white
115+
116+
**3. Enforce** ✅
117+
^^^
118+
119+
Switch to ``enforcement: enforce``
120+
121+
+++
122+
123+
Remaining violations are rejected at submission
124+
125+
Changing a policy leaves existing and in-flight workflows untouched. To roll back, set ``enforcement: warn``; to disable the key entirely, set ``enforcement: "off"`` or remove the entry. In ConfigMap mode, an invalid edit is rejected and the previous valid snapshot stays active.
126+
127+
.. warning::
128+
129+
Removing a value from an allow-list while the key is in ``enforce`` mode rejects every later submission that uses it, including restarts of workflows that were accepted earlier. Soak the change in ``warn`` first.
130+
131+
132+
Prefixing Pod Labels
133+
====================
134+
135+
``pod_label_prefix`` is prepended to every workflow label key when labels are stamped onto task pods, and nowhere else:
136+
137+
.. code-block:: yaml
138+
139+
labels_config:
140+
pod_label_prefix: example.com/
141+
policy:
142+
- key: team
143+
enforcement: warn
144+
145+
A workflow submitted with ``team: robotics`` then carries ``example.com/team=robotics`` on its pods. Everywhere else keeps the bare ``team`` key: the stored specification, the workflow API, list filters, the CLI, and the metric attributes below. Users never type or query the prefix.
146+
147+
The prefix is an opaque string, not an assumed DNS prefix: it is joined to the label key, and the merged key is validated as a Kubernetes label key at submission, in the same check as the policy. An invalid merged key is rejected with an error reporting the original key, the prefix, and the result.
148+
149+
.. tip::
150+
151+
Set a prefix when task pods share a cluster with unrelated workloads. Pod labels are exported by key name, so a short key such as ``team`` can match an identically named label on another pod.
152+
153+
154+
.. _workflow_labels_metrics:
155+
156+
Metrics
157+
=======
158+
159+
Only configured policy keys become workflow-label dimensions on ``osmo_tasks_count``. Attribute names start with ``workflow_label_``. Letters and numbers are unchanged; ``_``, ``-``, ``.``, and ``/`` are encoded as ``__``, ``_dash_``, ``_dot_``, and ``_slash_`` respectively. For example, ``project`` is exported as ``workflow_label_project``.
160+
161+
.. list-table::
162+
:header-rows: 1
163+
:widths: 30 70
164+
165+
* - **Exported value**
166+
- **When**
167+
* - The value itself
168+
- The value is in the configured allow-list.
169+
* - ``<other>``
170+
- The key is present with a value outside that list. An empty allow-list exports every value this way.
171+
* - ``<missing>``
172+
- The key is absent.
173+
174+
This bounds the series count to the allow-list plus two sentinels per key, so keep the policy list small to control cardinality.
175+
176+
Admission also emits ``osmo_label_validation_total{key, outcome}``, where ``outcome`` is ``ok``, ``missing``, ``invalid``, or ``rejected``. The counter covers rejected submissions that never create a workflow row.
177+
178+
.. seealso::
179+
180+
Exporting a Pod label through ``kube_pod_labels`` is a separate kube-state-metrics allow-list decision; see :ref:`adding_observability`.

docs/deployment_guide/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ An OSMO deployment consists of two main components:
149149
advanced_config/scheduler
150150
advanced_config/rsync
151151
advanced_config/workflow_pod_workload_identity
152+
advanced_config/workflow_labels
152153
advanced_config/mcp
153154

154155
.. toctree::

docs/deployment_guide/references/configs_definitions/workflow.rst

Lines changed: 27 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ Top-Level Configuration
7272
- See Plugins section
7373
* - ``labels_config``
7474
- `Workflow Labels`_
75-
- Workflow-label policies, accepted values, and staged enforcement.
75+
- Workflow-label policies, accepted values, staged enforcement, and the
76+
optional pod-label prefix.
7677
- ``policy: []``
7778
* - ``max_num_tasks``
7879
- Integer
@@ -247,29 +248,31 @@ Workflow Information
247248
Workflow Labels
248249
===============
249250

250-
Workflow labels are optional and format-checked even when no label is required.
251-
The default configuration applies no label policies:
251+
Policy and prefix behavior, enforcement rollout, and the exported metrics are
252+
described in :ref:`workflow_labels_config`.
252253

253-
.. code-block:: yaml
254-
255-
labels_config:
256-
policy: []
257-
258-
Each entry in ``policy`` controls one key independently. Use ``off`` or omit a
259-
key from ``policy`` to disable both warnings and enforcement for that key:
254+
.. list-table::
255+
:header-rows: 1
256+
:widths: 25 12 43 20
260257

261-
.. code-block:: yaml
258+
* - **Field**
259+
- **Type**
260+
- **Description**
261+
- **Default Values**
262+
* - ``policy``
263+
- List of `Label Policy`_
264+
- One entry per label key to check. At most 16 entries; duplicate keys are
265+
rejected.
266+
- ``[]``
267+
* - ``pod_label_prefix``
268+
- String
269+
- Prepended to each workflow label key on task pods only. Empty disables
270+
it. Rejected at configuration time if it contains a space, tab, or line
271+
break, or exceeds 253 characters.
272+
- ``""``
262273

263-
labels_config:
264-
policy:
265-
- key: team
266-
allow_list:
267-
- robotics
268-
- simulation
269-
enforcement: warn
270-
- key: cost-center
271-
allow_list: []
272-
enforcement: enforce
274+
Label Policy
275+
============
273276

274277
.. list-table::
275278
:header-rows: 1
@@ -281,55 +284,19 @@ key from ``policy`` to disable both warnings and enforcement for that key:
281284
- **Default Values**
282285
* - ``key``
283286
- String
284-
- Kubernetes label key to check. Duplicate policy keys are rejected,
285-
and at most 16 keys can be configured.
287+
- Kubernetes label key to check.
286288
- Required
287289
* - ``allow_list``
288290
- List of Strings
289291
- Exact accepted values. An empty list accepts any well-formed value.
290292
- ``[]``
291293
* - ``enforcement``
292294
- String (``"off"``, ``warn``, ``enforce``)
293-
- ``off`` accepts without policy warnings. ``warn`` accepts but warns
294-
when the key is missing or its value is outside a non-empty allow-list.
295+
- ``off`` accepts without policy warnings. ``warn`` accepts but warns when
296+
the key is missing or its value is outside a non-empty allow-list.
295297
``enforce`` rejects those violations.
296298
- ``"off"``
297299

298-
The same policy applies to new submissions, resubmission by ID, restart, and
299-
validation-only requests. An ``enforcement: enforce`` rejection creates
300-
neither a workflow row nor a stored specification. Submit responses carry
301-
warnings from that admission check. Warnings are not stored with the
302-
workflow: detail responses recompute warn-mode violations from the stored
303-
labels and the current configuration, so displayed warnings track policy
304-
changes even for completed workflows.
305-
306-
To roll back enforcement immediately, use ``enforcement: warn``. To disable both
307-
warnings and enforcement, use ``enforcement: "off"`` (quoted: unquoted YAML
308-
``off`` parses as boolean false) or remove the policy entry.
309-
Existing and in-flight workflows are not modified, although their detail-page
310-
warnings always reflect the current warn policy. In ConfigMap mode, an invalid
311-
edit is rejected and the previous valid snapshot remains active.
312-
313-
Only configured policy keys become workflow-label dimensions on
314-
``osmo_tasks_count``. Attribute names start with ``workflow_label_``. Letters
315-
and numbers are unchanged; ``_``, ``-``, ``.``, and ``/`` are encoded as
316-
``__``, ``_dash_``, ``_dot_``, and ``_slash_`` respectively. For example,
317-
``project`` is exported as ``workflow_label_project``. Values in the configured
318-
allow-list are exported verbatim; a present value outside that list is clamped
319-
to ``<other>``, and a missing key is reported as ``<missing>``. Angle
320-
brackets are not valid in label values, so the sentinels never collide with
321-
real values. An empty allow-list exports every present value as ``<other>``.
322-
This keeps the number of series bounded to the allow-list plus two sentinels
323-
per key.
324-
325-
Admission also emits
326-
``osmo_label_validation_total{key, outcome}``, where ``outcome`` is ``ok``,
327-
``missing``, ``invalid``, or ``rejected``. The counter covers rejected
328-
submissions that do not create a workflow row. Keep the policy list small to
329-
control metric cardinality. Exporting a Pod label through ``kube_pod_labels`` is a
330-
separate kube-state-metrics allow-list decision; see
331-
:ref:`adding_observability`.
332-
333300
Backend Images
334301
==============
335302

docs/spelling_wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ preflight
248248
Preflight
249249
prem
250250
prepend
251+
prepended
251252
Preprocess
252253
programmatically
253254
prometheus

docs/user_guide/workflows/specification/index.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,12 @@ Workflow
6969
Workflow Labels
7070
---------------
7171

72-
Labels identify a workflow independently of mutable tags. Keys and values use
73-
Kubernetes label syntax, values must be non-empty, and a workflow can define
74-
at most 16 labels. Labels are stored with the submitted specification and
75-
copied only to task pods, not to Services, Secrets, scheduler groups, or
76-
other objects. Any syntactically valid key is accepted; where a workflow
77-
label collides with a system-owned pod label (the ``osmo.`` selectors or
78-
scheduler queue labels), the system value wins on the pod.
72+
Labels are immutable metadata for a workflow, set at submission. Keys and
73+
values use Kubernetes label syntax, values must be non-empty, and a workflow
74+
can define at most 16 labels. Labels are stored with the submitted
75+
specification and copied to task pods only. Any syntactically valid key is
76+
accepted; if a key collides with a system-owned pod label (an ``osmo.``
77+
selector or a scheduler queue label), the system value wins on the pod.
7978

8079
.. code-block:: yaml
8180
@@ -90,10 +89,14 @@ scheduler queue labels), the system value wins on the pod.
9089
command: [bash]
9190
args: [-lc, "echo training"]
9291
93-
Your administrator may configure particular keys in ``off``, ``warn``, or
94-
``enforce`` mode. A submission can succeed and still print a warning while an
95-
administrator is rolling out a requirement. Use :ref:`workflow_submission` to
96-
validate and override labels without editing a shared specification.
92+
Your administrator may require particular keys. In ``warn`` mode a submission
93+
succeeds but prints a warning, so a requirement can be announced before it is
94+
enforced; in ``enforce`` mode it is rejected. Use :ref:`workflow_submission` to
95+
validate labels, or to override them without editing a shared specification.
96+
97+
Your administrator may also configure a prefix added to label keys on task
98+
pods, so a pod can show ``example.com/team`` where the specification said
99+
``team``.
97100

98101
.. _workflow_spec_task:
99102

docs/user_guide/workflows/submission.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,18 +223,16 @@ or a missing key:
223223
$ osmo workflow list --label 'team=robotics_(a|b)'
224224
$ osmo workflow list --no-label team
225225
226-
Label selectors are case-sensitive. In a glob selector, ``*`` matches zero or
227-
more characters; every other character, including ``_``, is literal. A
228-
parenthesized ``|`` group can appear within a selector and matches any one of
229-
its alternatives. Alternatives can contain ``*`` wildcards. Groups are flat
230-
(not nested), each group must contain at least two non-empty alternatives,
231-
and the alternatives in a selector may multiply out to at most 32
232-
combinations. Quote pattern selectors so the shell does not interpret them.
233-
234-
Repeated ``--label`` filters are combined with AND, so every supplied
235-
selector must match. Alternatives within one selector are combined with OR. Pattern syntax
236-
applies only to workflow list filters; submission and validation labels must
237-
still contain exact Kubernetes label values.
226+
Label selectors are case-sensitive. ``*`` matches zero or more characters;
227+
every other character, including ``_``, is literal. A parenthesized ``|`` group
228+
matches any one of its alternatives, which can themselves contain ``*``. Groups
229+
cannot nest, each needs at least two alternatives, and one selector can expand
230+
to at most 32 combinations. Quote selectors so the shell does not interpret
231+
them.
232+
233+
Repeated ``--label`` filters combine with AND; alternatives within one selector
234+
combine with OR. Pattern syntax applies only to list filters: submission and
235+
validation still require exact Kubernetes label values.
238236

239237
Dry Run Validation
240238
~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)