You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: config.md
+75Lines changed: 75 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -231,4 +231,79 @@ If a hook returns a non-zero exit code, then an error is logged and the remainin
231
231
`args` and `env` are optional.
232
232
The semantics are the same as `Path`, `Args` and `Env` in [golang Cmd](https://golang.org/pkg/os/exec/#Cmd).
233
233
234
+
## Labels
235
+
236
+
_Labels_ are key/value pairs that can be optionally attached to containers.
237
+
Labels are intended to be used to specify identifying attributes of containers that are meaningful and relevant to users, but which do not directly imply semantics to the runtime.
238
+
Labels can be used to select subsets of containers.
239
+
Each Key must be unique for a container.
240
+
241
+
```json
242
+
"labels": {
243
+
"key1": "value1",
244
+
"key2": "value2"
245
+
}
246
+
```
247
+
248
+
Since labels will be used to sorting and grouping in UIs, CLIs, etc., we don't want to pollute labels with non-identifying, especially large and/or structured, data.
249
+
Non-identifying information should be recorded using Annotations.
250
+
251
+
### Syntax and character set
252
+
253
+
_Labels_ are key value pairs.
254
+
Valid label keys have two segments: an optional prefix and name, separated by a slash (`/`).
255
+
The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between.
256
+
The prefix is optional.
257
+
If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (`.`), not longer than 253 characters in total, followed by a slash (`/`).
258
+
If the prefix is omitted, the label key is presumed to be private to the user.
259
+
260
+
Valid label values must be 63 characters or less and must be empty or begin and end with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between.
261
+
262
+
### Label selectors
263
+
264
+
Labels do not provide uniqueness.
265
+
In general, we expect many containers to carry the same label(s).
266
+
267
+
Via a _label selector_, the client/user can identify a set of containers.
268
+
269
+
A label selector can be made of multiple _requirements_ which are comma-separated.
270
+
In the case of multiple requirements, all must be satisfied so the comma separator acts as an _AND_ logical operator.
271
+
272
+
An empty label selector (that is, one with zero requirements) selects all containers.
273
+
274
+
#### _Equality-based_ requirement
275
+
276
+
_Equality-_ or _inequality-based_ requirements allow filtering by label keys and values.
277
+
Matching containers must satisfy all of the specified label constraints, though they may have additional labels as well.
278
+
Three kinds of operators are admitted `=`,`==`,`!=`.
279
+
The first two represent _equality_ (and are simply synonyms), while the latter represents _inequality_. For example:
280
+
281
+
```
282
+
environment = production
283
+
tier != frontend
284
+
```
285
+
286
+
The former selects all resources with key equal to `environment` and value equal to `production`.
287
+
The latter selects all resources with key equal to `tier` and value distinct from `frontend`, and all resources with no labels with the `tier` key.
288
+
One could filter for resources in `production` excluding `frontend` using the comma operator: `environment=production,tier!=frontend`
289
+
290
+
### CLI Examples
291
+
292
+
```console
293
+
$ runtime list -l enviroment=production,tier=frontend
294
+
```
295
+
296
+
## Annotations
297
+
298
+
Annotations are optional arbitrary non-identifying metadata that can be attached to containers.
299
+
This information may be large, may be structured or unstructured, may include characters not permitted by labels.
0 commit comments