diff --git a/pkg/controllers/multiclusterservice/endpointslice_dispatch_controller.go b/pkg/controllers/multiclusterservice/endpointslice_dispatch_controller.go index bf65147c11e7..b7a085173497 100644 --- a/pkg/controllers/multiclusterservice/endpointslice_dispatch_controller.go +++ b/pkg/controllers/multiclusterservice/endpointslice_dispatch_controller.go @@ -42,6 +42,7 @@ import ( clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1" networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1" workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" "github.com/karmada-io/karmada/pkg/events" "github.com/karmada-io/karmada/pkg/util" "github.com/karmada-io/karmada/pkg/util/fedinformer/genericmanager" @@ -383,15 +384,15 @@ func (c *EndpointsliceDispatchController) ensureEndpointSliceWork(mcs *networkin endpointSlice.Name = providerCluster + "-" + endpointSlice.Name clusterNamespace := names.GenerateExecutionSpaceName(consumerCluster) endpointSlice.Labels = map[string]string{ - discoveryv1.LabelServiceName: mcs.Name, - workv1alpha1.WorkNamespaceLabel: clusterNamespace, - workv1alpha1.WorkNameLabel: work.Name, - util.ManagedByKarmadaLabel: util.ManagedByKarmadaLabelValue, - discoveryv1.LabelManagedBy: util.EndpointSliceDispatchControllerLabelValue, + discoveryv1.LabelServiceName: mcs.Name, + util.ManagedByKarmadaLabel: util.ManagedByKarmadaLabelValue, + discoveryv1.LabelManagedBy: util.EndpointSliceDispatchControllerLabelValue, } endpointSlice.Annotations = map[string]string{ // This annotation is used to identify the source cluster of EndpointSlice and whether the eps are the newest version util.EndpointSliceProvisionClusterAnnotation: providerCluster, + workv1alpha2.WorkNamespaceAnnotation: clusterNamespace, + workv1alpha2.WorkNameAnnotation: work.Name, } workMeta := metav1.ObjectMeta{ diff --git a/pkg/controllers/namespace/namespace_sync_controller.go b/pkg/controllers/namespace/namespace_sync_controller.go index efed0d6bce78..1af7f95c2cf0 100644 --- a/pkg/controllers/namespace/namespace_sync_controller.go +++ b/pkg/controllers/namespace/namespace_sync_controller.go @@ -40,7 +40,7 @@ import ( clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1" policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" - workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" "github.com/karmada-io/karmada/pkg/controllers/binding" "github.com/karmada-io/karmada/pkg/util" "github.com/karmada-io/karmada/pkg/util/helper" @@ -160,9 +160,9 @@ func (c *Controller) buildWorks(namespace *corev1.Namespace, clusters []clusterv Annotations: annotations, } - util.MergeLabel(clonedNamespaced, workv1alpha1.WorkNamespaceLabel, workNamespace) - util.MergeLabel(clonedNamespaced, workv1alpha1.WorkNameLabel, workName) util.MergeLabel(clonedNamespaced, util.ManagedByKarmadaLabel, util.ManagedByKarmadaLabelValue) + util.MergeAnnotation(clonedNamespaced, workv1alpha2.WorkNamespaceAnnotation, workNamespace) + util.MergeAnnotation(clonedNamespaced, workv1alpha2.WorkNameAnnotation, workName) if err = helper.CreateOrUpdateWork(c.Client, objectMeta, clonedNamespaced); err != nil { ch <- fmt.Errorf("sync namespace(%s) to cluster(%s) failed due to: %v", clonedNamespaced.GetName(), cluster.GetName(), err) diff --git a/pkg/controllers/unifiedauth/unified_auth_controller.go b/pkg/controllers/unifiedauth/unified_auth_controller.go index 63545d4633e0..f4736d734424 100644 --- a/pkg/controllers/unifiedauth/unified_auth_controller.go +++ b/pkg/controllers/unifiedauth/unified_auth_controller.go @@ -37,7 +37,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1" - workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" "github.com/karmada-io/karmada/pkg/events" "github.com/karmada-io/karmada/pkg/util" "github.com/karmada-io/karmada/pkg/util/helper" @@ -235,9 +235,9 @@ func (c *Controller) buildWorks(cluster *clusterv1alpha1.Cluster, obj *unstructu }, } - util.MergeLabel(obj, workv1alpha1.WorkNamespaceLabel, workNamespace) - util.MergeLabel(obj, workv1alpha1.WorkNameLabel, clusterRoleBindingWorkName) util.MergeLabel(obj, util.ManagedByKarmadaLabel, util.ManagedByKarmadaLabelValue) + util.MergeAnnotation(obj, workv1alpha2.WorkNamespaceAnnotation, workNamespace) + util.MergeAnnotation(obj, workv1alpha2.WorkNameAnnotation, clusterRoleBindingWorkName) if err := helper.CreateOrUpdateWork(c.Client, objectMeta, obj); err != nil { return err