Merge pull request #4793 from whitewindmills/fix-work-permanentID

Use merge strategy to avoid work.karmada.io/permanent-id changes
This commit is contained in:
karmada-bot 2024-04-03 18:22:44 +08:00 committed by GitHub
commit 4f99ebd447
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -78,8 +78,8 @@ func CreateOrUpdateWork(client client.Client, workMeta metav1.ObjectMeta, resour
}
runtimeObject.Spec = work.Spec
runtimeObject.Labels = work.Labels
runtimeObject.Annotations = work.Annotations
runtimeObject.Labels = util.DedupeAndMergeLabels(runtimeObject.Labels, work.Labels)
runtimeObject.Annotations = util.DedupeAndMergeAnnotations(runtimeObject.Annotations, work.Annotations)
if util.GetLabelValue(runtimeObject.Labels, workv1alpha2.WorkPermanentIDLabel) == "" {
runtimeObject.Labels = util.DedupeAndMergeLabels(runtimeObject.Labels, map[string]string{workv1alpha2.WorkPermanentIDLabel: uuid.New().String()})
}