From 1706df6242c34d73a5a91a3d856dd1a7f12c7623 Mon Sep 17 00:00:00 2001 From: Janet Kuo Date: Tue, 1 Mar 2016 17:12:24 -0800 Subject: [PATCH 1/2] Revision number should be updated only when it's smaller than it should be --- pkg/controller/deployment/deployment_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/controller/deployment/deployment_controller.go b/pkg/controller/deployment/deployment_controller.go index c68a6a8612d..7d90fbed150 100644 --- a/pkg/controller/deployment/deployment_controller.go +++ b/pkg/controller/deployment/deployment_controller.go @@ -758,7 +758,7 @@ func setNewReplicaSetAnnotations(deployment *extensions.Deployment, rs *extensio if rs.Annotations == nil { rs.Annotations = make(map[string]string) } - if rs.Annotations[deploymentutil.RevisionAnnotation] != newRevision { + if rs.Annotations[deploymentutil.RevisionAnnotation] < newRevision { rs.Annotations[deploymentutil.RevisionAnnotation] = newRevision annotationChanged = true glog.V(4).Infof("updating replica set %q's revision to %s - %+v\n", rs.Name, newRevision, rs) From 67bfe5d796012cf580b5762b30208680948afcb9 Mon Sep 17 00:00:00 2001 From: Janet Kuo Date: Tue, 1 Mar 2016 17:25:44 -0800 Subject: [PATCH 2/2] Avoid copying deployment revision annotations to rs --- pkg/controller/deployment/deployment_controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controller/deployment/deployment_controller.go b/pkg/controller/deployment/deployment_controller.go index 7d90fbed150..0ae204f3096 100644 --- a/pkg/controller/deployment/deployment_controller.go +++ b/pkg/controller/deployment/deployment_controller.go @@ -774,10 +774,10 @@ func copyDeploymentAnnotationsToReplicaSet(deployment *extensions.Deployment, rs rs.Annotations = make(map[string]string) } for k, v := range deployment.Annotations { - // Skip apply annotations + // Skip apply annotations and revision annotations // TODO: How to decide which annotations should / should not be copied? // See https://github.com/kubernetes/kubernetes/pull/20035#issuecomment-179558615 - if k == kubectl.LastAppliedConfigAnnotation || rs.Annotations[k] == v { + if k == kubectl.LastAppliedConfigAnnotation || k == deploymentutil.RevisionAnnotation || rs.Annotations[k] == v { continue } rs.Annotations[k] = v