mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #15814 from soltysh/job_doc
Update job user-guide doc to reflect recent changes to .spec.selector
This commit is contained in:
commit
a254fdc062
@ -1,10 +1,11 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: extensions/v1beta1
|
||||||
kind: Job
|
kind: Job
|
||||||
metadata:
|
metadata:
|
||||||
name: pi
|
name: pi
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: pi
|
matchLabels:
|
||||||
|
app: pi
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
name: pi
|
name: pi
|
||||||
|
@ -70,13 +70,14 @@ It takes around 10s to complete.
|
|||||||
<!-- BEGIN MUNGE: EXAMPLE job.yaml -->
|
<!-- BEGIN MUNGE: EXAMPLE job.yaml -->
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: extensions/v1beta1
|
||||||
kind: Job
|
kind: Job
|
||||||
metadata:
|
metadata:
|
||||||
name: pi
|
name: pi
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: pi
|
matchLabels:
|
||||||
|
app: pi
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
name: pi
|
name: pi
|
||||||
@ -162,11 +163,16 @@ Only a [`RestartPolicy`](pod-states.md) equal to `Never` or `OnFailure` are allo
|
|||||||
|
|
||||||
### Pod Selector
|
### Pod Selector
|
||||||
|
|
||||||
The `.spec.selector` field is a pod selector. It works the same as the `.spec.selector` of
|
The `.spec.selector` field is a label query over a set of pods.
|
||||||
a [ReplicationController](replication-controller.md).
|
|
||||||
|
|
||||||
If specified, the `.spec.template.metadata.labels` must be equal to the `.spec.selector`, or it will
|
The `spec.selector` is an object consisting of two fields:
|
||||||
be rejected by the API. If `.spec.selector` is unspecified, it will be defaulted to
|
* `matchLabels` - works the same as the `.spec.selector` of a [ReplicationController](replication-controller.md)
|
||||||
|
* `matchExpressions` - allows to build more sophisticated selectors by specyfing key,
|
||||||
|
list of values and an operator that relates the key and values.
|
||||||
|
|
||||||
|
When the two are specified the result is ANDed.
|
||||||
|
|
||||||
|
If `.spec.selector` is unspecified, `.spec.selector.matchLabels` will be defaulted to
|
||||||
`.spec.template.metadata.labels`.
|
`.spec.template.metadata.labels`.
|
||||||
|
|
||||||
Also you should not normally create any pods whose labels match this selector, either directly,
|
Also you should not normally create any pods whose labels match this selector, either directly,
|
||||||
|
Loading…
Reference in New Issue
Block a user