diff --git a/pkg/controller/deployment/util/deployment_util.go b/pkg/controller/deployment/util/deployment_util.go index b4c8fb48a25..3c33db26531 100644 --- a/pkg/controller/deployment/util/deployment_util.go +++ b/pkg/controller/deployment/util/deployment_util.go @@ -253,7 +253,23 @@ func SetNewReplicaSetAnnotations(deployment *extensions.Deployment, newRS *exten // The newRS's revision should be the greatest among all RSes. Usually, its revision number is newRevision (the max revision number // of all old RSes + 1). However, it's possible that some of the old RSes are deleted after the newRS revision being updated, and // newRevision becomes smaller than newRS's revision. We should only update newRS revision when it's smaller than newRevision. - if oldRevision < newRevision { + + oldRevisionInt, err := strconv.ParseInt(oldRevision, 10, 64) + if err != nil { + if oldRevision != "" { + glog.Warningf("Updating replica set revision OldRevision not int %s", err) + return false + } + //If the RS annotation is empty then initialise it to 0 + oldRevisionInt = 0 + } + newRevisionInt, err := strconv.ParseInt(newRevision, 10, 64) + if err != nil { + glog.Warningf("Updating replica set revision NewRevision not int %s", err) + return false + } + glog.Warningf("OldRevision=%d Newrevsion=%d\n", oldRevisionInt, newRevisionInt) + if oldRevisionInt < newRevisionInt { newRS.Annotations[RevisionAnnotation] = newRevision annotationChanged = true glog.V(4).Infof("Updating replica set %q revision to %s", newRS.Name, newRevision)