Skip to content

Commit af7c064

Browse files
liyinan926steveperry-53
authored andcommittedSep 19, 2017
Updated Deployments concepts doc (#5491)
* Updated Deployments concepts doc * Addressed comments * Addressed more comments
1 parent 366cc81 commit af7c064

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed
 

‎docs/concepts/workloads/controllers/deployment.md

+7-17
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ It is generally discouraged to make label selector updates and it is suggested t
288288
In any case, if you need to perform a label selector update, exercise great caution and make sure you have grasped
289289
all of the implications.
290290

291+
**Note:** In API version `apps/v1beta2`, a Deployment's label selector is immutable after it gets created.
292+
{: .note}
293+
291294
* Selector additions require the pod template labels in the Deployment spec to be updated with the new label too,
292295
otherwise a validation error is returned. This change is a non-overlapping one, meaning that the new selector does
293296
not select ReplicaSets and Pods created with the old selector, resulting in orphaning all old ReplicaSets and
@@ -850,9 +853,9 @@ allowed, which is the default if not specified.
850853
`.spec.selector` is an optional field that specifies a [label selector](/docs/concepts/overview/working-with-objects/labels/)
851854
for the Pods targeted by this deployment.
852855

853-
If specified, `.spec.selector` must match `.spec.template.metadata.labels`, or it will be rejected by
854-
the API. If `.spec.selector` is unspecified, `.spec.selector.matchLabels` defaults to
855-
`.spec.template.metadata.labels`.
856+
`.spec.selector` must match `.spec.template.metadata.labels`, or it will be rejected by the API.
857+
858+
In API version `apps/v1beta2`, `.spec.selector` and `.metadata.labels` no longer default to `.spec.template.metadata.labels` if not set. So they must be set explicitly. Also note that `.spec.selector` is immutable after creation of the Deployment in `apps/v1beta2`.
856859

857860
A Deployment may terminate Pods whose labels match the selector if their template is different
858861
from `.spec.template` or if the total number of such Pods exceeds `.spec.replicas`. It brings up new
@@ -926,20 +929,7 @@ a Pod is considered ready, see [Container Probes](/docs/concepts/workloads/pods/
926929

927930
### Rollback To
928931

929-
`.spec.rollbackTo` is an optional field with the configuration the Deployment
930-
should roll back to. Setting this field triggers a rollback, and this field will
931-
be cleared by the server after a rollback is done.
932-
933-
Because this field will be cleared by the server, it should not be used
934-
declaratively. For example, you should not perform `kubectl apply` with a
935-
manifest with `.spec.rollbackTo` field set.
936-
937-
#### Revision
938-
939-
`.spec.rollbackTo.revision` is an optional field specifying the revision to roll
940-
back to. Setting to 0 means rolling back to the last revision in history;
941-
otherwise, means rolling back to the specified revision. This defaults to 0 when
942-
[`spec.rollbackTo`](#rollback-to) is set.
932+
Field `.spec.rollbackTo` has been deprecated in API versions `extensions/v1beta1` and `apps/v1beta1`, and is no longer supported in API version `apps/v1beta2`. Instead, `kubectl rollout undo` as introduced in [Rolling Back to a Previous Revision](#rolling-back-to-a-previous-revision) should be used.
943933

944934
### Revision History Limit
945935

‎docs/concepts/workloads/controllers/nginx-deployment.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
apiVersion: apps/v1beta1 # for versions before 1.6.0 use extensions/v1beta1
1+
apiVersion: apps/v1beta2 # for versions before 1.7.0 use apps/v1beta1
22
kind: Deployment
33
metadata:
44
name: nginx-deployment
5+
labels:
6+
app: nginx
57
spec:
68
replicas: 3
9+
selector:
10+
matchLabels:
11+
app: nginx
712
template:
813
metadata:
914
labels:

0 commit comments

Comments
 (0)
Please sign in to comment.