Merge pull request #434 from janetkuo/deployments-restart-policy
Document Deployment restartPolicypull/443/head
commit
ebb5a5d61f
|
@ -432,6 +432,12 @@ The `.spec.template` is a [pod template](/docs/user-guide/replication-controller
|
||||||
the same schema as a [Pod](/docs/user-guide/pods), except it is nested and does not have an
|
the same schema as a [Pod](/docs/user-guide/pods), except it is nested and does not have an
|
||||||
`apiVersion` or `kind`.
|
`apiVersion` or `kind`.
|
||||||
|
|
||||||
|
In addition to required fields for a Pod, a pod template in a Deployment must specify appropriate
|
||||||
|
labels (i.e. don't overlap with other controllers, see [selector](#selector)) and an appropriate restart policy.
|
||||||
|
|
||||||
|
Only a [`.spec.template.spec.restartPolicy`](/docs/user-guide/pod-states/) equal to `Always` is allowed, which is the default
|
||||||
|
if not specified.
|
||||||
|
|
||||||
### Replicas
|
### Replicas
|
||||||
|
|
||||||
`.spec.replicas` is an optional field that specifies the number of desired Pods. It defaults
|
`.spec.replicas` is an optional field that specifies the number of desired Pods. It defaults
|
||||||
|
@ -439,8 +445,14 @@ to 1.
|
||||||
|
|
||||||
### Selector
|
### Selector
|
||||||
|
|
||||||
`.spec.selector` is an optional field that specifies label selectors for Pods
|
`.spec.selector` is an optional field that specifies a [label selector](/docs/user-guide/labels/#label-selectors) for the Pods
|
||||||
targeted by this deployment. Deployment kills some of these Pods, if their
|
targeted by this deployment.
|
||||||
|
|
||||||
|
If specified, `.spec.selector` must match `.spec.template.metadata.labels`, or it will
|
||||||
|
be rejected by the API. If `.spec.selector` is unspecified, `.spec.selector.matchLabels` will be defaulted to
|
||||||
|
`.spec.template.metadata.labels`.
|
||||||
|
|
||||||
|
Deployment may kill Pods whose labels match the selector, in the case that their
|
||||||
template is different than `.spec.template` or if the total number of such Pods
|
template is different than `.spec.template` or if the total number of such Pods
|
||||||
exceeds `.spec.replicas`. It will bring up new Pods with `.spec.template` if
|
exceeds `.spec.replicas`. It will bring up new Pods with `.spec.template` if
|
||||||
number of Pods are less than the desired number.
|
number of Pods are less than the desired number.
|
||||||
|
|
|
@ -54,6 +54,8 @@ An empty label selector (that is, one with zero requirements) selects every obje
|
||||||
|
|
||||||
A null label selector (which is only possible for optional selector fields) selects no objects.
|
A null label selector (which is only possible for optional selector fields) selects no objects.
|
||||||
|
|
||||||
|
**Note**: the label selectors of two controllers must not overlap within a namespace, otherwise they will fight with each other.
|
||||||
|
|
||||||
### _Equality-based_ requirement
|
### _Equality-based_ requirement
|
||||||
|
|
||||||
_Equality-_ or _inequality-based_ requirements allow filtering by label keys and values. Matching objects must satisfy all of the specified label constraints, though they may have additional labels as well.
|
_Equality-_ or _inequality-based_ requirements allow filtering by label keys and values. Matching objects must satisfy all of the specified label constraints, though they may have additional labels as well.
|
||||||
|
@ -147,9 +149,9 @@ selector:
|
||||||
|
|
||||||
this selector (respectively in `json` or `yaml` format) is equivalent to `component=redis` or `component in (redis)`.
|
this selector (respectively in `json` or `yaml` format) is equivalent to `component=redis` or `component in (redis)`.
|
||||||
|
|
||||||
#### Job and other new resources
|
#### Resources that support set-based requirements
|
||||||
|
|
||||||
Newer resources, such as [job](/docs/user-guide/jobs), support _set-based_ requirements as well.
|
Newer resources, such as [`Job`](/docs/user-guide/jobs), [`Deployment`](/docs/user-guide/deployments/), [`Replica Set`](/docs/user-guide/replicasets/), and [`Daemon Set`](/docs/admin/daemons/), support _set-based_ requirements as well.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
selector:
|
selector:
|
||||||
|
|
|
@ -96,10 +96,10 @@ The `.spec.template` is a [pod template](#pod-template). It has exactly
|
||||||
the same schema as a [pod](/docs/user-guide/pods/), except it is nested and does not have an `apiVersion` or
|
the same schema as a [pod](/docs/user-guide/pods/), except it is nested and does not have an `apiVersion` or
|
||||||
`kind`.
|
`kind`.
|
||||||
|
|
||||||
In addition to required fields for a Pod, a pod template in a job must specify appropriate
|
In addition to required fields for a Pod, a pod template in a Replication Controller must specify appropriate
|
||||||
labels (see [pod selector](#pod-selector) and an appropriate restart policy.
|
labels (i.e. don't overlap with other controllers, see [pod selector](#pod-selector)) and an appropriate restart policy.
|
||||||
|
|
||||||
Only a [`RestartPolicy`](/docs/user-guide/pod-states/) equal to `Always` is allowed, which is the default
|
Only a [`.spec.template.spec.restartPolicy`](/docs/user-guide/pod-states/) equal to `Always` is allowed, which is the default
|
||||||
if not specified.
|
if not specified.
|
||||||
|
|
||||||
For local container restarts, replication controllers delegate to an agent on the node,
|
For local container restarts, replication controllers delegate to an agent on the node,
|
||||||
|
|
Loading…
Reference in New Issue