Merge pull request #22326 from janetkuo/only-increase-revision

RS revision number should only be updated when necessary
This commit is contained in:
Brian Grant 2016-03-01 20:07:42 -08:00
commit 0867e250c6

View File

@ -758,7 +758,7 @@ func setNewReplicaSetAnnotations(deployment *extensions.Deployment, rs *extensio
if rs.Annotations == nil { if rs.Annotations == nil {
rs.Annotations = make(map[string]string) rs.Annotations = make(map[string]string)
} }
if rs.Annotations[deploymentutil.RevisionAnnotation] != newRevision { if rs.Annotations[deploymentutil.RevisionAnnotation] < newRevision {
rs.Annotations[deploymentutil.RevisionAnnotation] = newRevision rs.Annotations[deploymentutil.RevisionAnnotation] = newRevision
annotationChanged = true annotationChanged = true
glog.V(4).Infof("updating replica set %q's revision to %s - %+v\n", rs.Name, newRevision, rs) glog.V(4).Infof("updating replica set %q's revision to %s - %+v\n", rs.Name, newRevision, rs)
@ -774,10 +774,10 @@ func copyDeploymentAnnotationsToReplicaSet(deployment *extensions.Deployment, rs
rs.Annotations = make(map[string]string) rs.Annotations = make(map[string]string)
} }
for k, v := range deployment.Annotations { 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? // TODO: How to decide which annotations should / should not be copied?
// See https://github.com/kubernetes/kubernetes/pull/20035#issuecomment-179558615 // 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 continue
} }
rs.Annotations[k] = v rs.Annotations[k] = v