Fix the bug of mcs binding losing resourcebinding.karmada.io/permanent-id label

Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
This commit is contained in:
whitewindmills 2024-04-09 18:30:43 +08:00
parent feb2437e4d
commit b0bbaa32e7
1 changed files with 3 additions and 3 deletions

View File

@ -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