From 6a45dfba8cf645f5ec4c17ee5589d6da987fd4b2 Mon Sep 17 00:00:00 2001 From: changzhen Date: Tue, 26 Mar 2024 20:00:14 +0800 Subject: [PATCH] fix wrong annotation marks on resource Signed-off-by: changzhen --- pkg/detector/detector.go | 2 +- pkg/util/helper/work.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/detector/detector.go b/pkg/detector/detector.go index bf40b7a16e69..3bf202fcbb44 100644 --- a/pkg/detector/detector.go +++ b/pkg/detector/detector.go @@ -795,7 +795,7 @@ func (d *ResourceDetector) ClaimClusterPolicyForObject(object *unstructured.Unst util.MergeLabel(objectCopy, policyv1alpha1.ClusterPropagationPolicyLabel, policy.Name) util.MergeLabel(objectCopy, policyv1alpha1.ClusterPropagationPolicyPermanentIDLabel, policyID) - util.MergeAnnotation(objectCopy, policyv1alpha1.ClusterPropagationPolicyAnnotation, policy.Name) + util.ReplaceAnnotation(objectCopy, policyv1alpha1.ClusterPropagationPolicyAnnotation, policy.Name) return policyID, d.Client.Update(context.TODO(), objectCopy) } diff --git a/pkg/util/helper/work.go b/pkg/util/helper/work.go index 06d50aa0c53e..b76f7374de05 100644 --- a/pkg/util/helper/work.go +++ b/pkg/util/helper/work.go @@ -45,7 +45,7 @@ func CreateOrUpdateWork(client client.Client, workMeta metav1.ObjectMeta, resour if conflictResolution, ok := workMeta.GetAnnotations()[workv1alpha2.ResourceConflictResolutionAnnotation]; ok { util.ReplaceAnnotation(workload, workv1alpha2.ResourceConflictResolutionAnnotation, conflictResolution) } - util.MergeAnnotation(workload, workv1alpha2.ResourceTemplateUIDAnnotation, string(workload.GetUID())) + util.ReplaceAnnotation(workload, workv1alpha2.ResourceTemplateUIDAnnotation, string(workload.GetUID())) util.RecordManagedAnnotations(workload) workloadJSON, err := workload.MarshalJSON() if err != nil {