From c3c83b6c68429edcde1a8d6d3c153f21c1ab26dc Mon Sep 17 00:00:00 2001 From: whitewindmills Date: Tue, 9 Apr 2024 18:30:43 +0800 Subject: [PATCH] Fix the bug of mcs binding losing resourcebinding.karmada.io/permanent-id label Signed-off-by: whitewindmills --- pkg/controllers/multiclusterservice/mcs_controller.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/controllers/multiclusterservice/mcs_controller.go b/pkg/controllers/multiclusterservice/mcs_controller.go index 3fc91c8c3c4e..496e5096df45 100644 --- a/pkg/controllers/multiclusterservice/mcs_controller.go +++ b/pkg/controllers/multiclusterservice/mcs_controller.go @@ -409,12 +409,12 @@ func (c *MCSController) propagateService(ctx context.Context, mcs *networkingv1a } if util.GetLabelValue(bindingCopy.Labels, workv1alpha2.ResourceBindingPermanentIDLabel) == "" { - binding.Labels = util.DedupeAndMergeLabels(binding.Labels, + bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels, map[string]string{workv1alpha2.ResourceBindingPermanentIDLabel: uuid.New().String()}) } // Just update necessary fields, especially avoid modifying Spec.Clusters which is scheduling result, if already exists. - bindingCopy.Annotations = binding.Annotations - bindingCopy.Labels = binding.Labels + bindingCopy.Annotations = util.DedupeAndMergeAnnotations(bindingCopy.Annotations, binding.Annotations) + bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels, binding.Labels) bindingCopy.OwnerReferences = binding.OwnerReferences bindingCopy.Finalizers = binding.Finalizers bindingCopy.Spec.Placement = binding.Spec.Placement