From 6c36a48550c4090c05c3259ec7798657a6a60d44 Mon Sep 17 00:00:00 2001 From: waynepeking348 Date: Thu, 17 Sep 2020 23:36:35 +0800 Subject: [PATCH] fix bugs when copying deployment annotations to replicaSet if value is empty --- pkg/controller/deployment/util/deployment_util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/controller/deployment/util/deployment_util.go b/pkg/controller/deployment/util/deployment_util.go index fb1af676d4c..97a87848f60 100644 --- a/pkg/controller/deployment/util/deployment_util.go +++ b/pkg/controller/deployment/util/deployment_util.go @@ -319,7 +319,7 @@ func copyDeploymentAnnotationsToReplicaSet(deployment *apps.Deployment, rs *apps // newRS revision is updated automatically in getNewReplicaSet, and the deployment's revision number is then updated // by copying its newRS revision number. We should not copy deployment's revision to its newRS, since the update of // deployment revision number may fail (revision becomes stale) and the revision number in newRS is more reliable. - if skipCopyAnnotation(k) || rs.Annotations[k] == v { + if _, exist := rs.Annotations[k]; skipCopyAnnotation(k) || (exist && rs.Annotations[k] == v) { continue } rs.Annotations[k] = v