From 07e407668deed80bdd98fd2c7140891490160549 Mon Sep 17 00:00:00 2001 From: baoyinghai_yewu Date: Thu, 31 Oct 2024 15:23:12 +0800 Subject: [PATCH] fix: don't update anp eps when api use nodeport Signed-off-by: baoyinghai_yewu --- .../konnectivity_sync_controller.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/kubenest/controller/endpoints.sync.controller/konnectivity_sync_controller.go b/pkg/kubenest/controller/endpoints.sync.controller/konnectivity_sync_controller.go index 52e8277e1..bd133fe47 100644 --- a/pkg/kubenest/controller/endpoints.sync.controller/konnectivity_sync_controller.go +++ b/pkg/kubenest/controller/endpoints.sync.controller/konnectivity_sync_controller.go @@ -73,7 +73,7 @@ func (e *KonnectivityController) SyncVirtualClusterEPS(ctx context.Context, k8sC return fmt.Errorf("eps %s has no subsets", eps.Name) } - // only sync the port of the konnectivity-server endpoints + // only sync the address of the konnectivity-server endpoints targetPort := virtualEndPoints.Subsets[0].Ports[0].Port updateEPS := virtualEndPoints.DeepCopy() @@ -124,6 +124,10 @@ func (e *KonnectivityController) Reconcile(ctx context.Context, request reconcil return reconcile.Result{RequeueAfter: utils.DefaultRequeueTime}, nil } + if targetVirtualCluster.Spec.KubeInKubeConfig != nil && targetVirtualCluster.Spec.KubeInKubeConfig.APIServerServiceType == v1alpha1.NodePort { + return reconcile.Result{RequeueAfter: utils.DefaultRequeueTime}, nil + } + k8sClient, err := util.GenerateKubeclient(targetVirtualCluster) if err != nil { klog.Errorf("virtualcluster %s crd kubernetes client failed: %v", targetVirtualCluster.Name, err)