add work namespace/name annotations in the eps

Signed-off-by: changzhen <changzhen5@huawei.com>
This commit is contained in:
changzhen 2024-06-12 16:28:57 +08:00
parent 2ad9cbb694
commit dca46571fe
1 changed files with 4 additions and 0 deletions

View File

@ -163,6 +163,10 @@ func (c *EndpointSliceController) collectEndpointSliceFromWork(work *workv1alpha
discoveryv1.LabelServiceName: names.GenerateDerivedServiceName(work.Labels[util.ServiceNameLabel]),
util.ManagedByKarmadaLabel: util.ManagedByKarmadaLabelValue,
})
desiredEndpointSlice.Annotations = util.DedupeAndMergeAnnotations(desiredEndpointSlice.Annotations, map[string]string{
workv1alpha2.WorkNamespaceAnnotation: work.Namespace,
workv1alpha2.WorkNameAnnotation: work.Name,
})
if err = helper.CreateOrUpdateEndpointSlice(c.Client, desiredEndpointSlice); err != nil {
return err