From b17203067e033c80c0939877b35d37b3784ad7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=AF=E8=88=AA?= <101104760+ZhangSetSail@users.noreply.github.com> Date: Thu, 19 Dec 2024 11:20:19 +0800 Subject: [PATCH] fix: create outer svc error (#2108) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张启航 <101104760+ZhangSetSail@users.noreply.github.com> --- api/controller/apigateway/api_gateway_route.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/api/controller/apigateway/api_gateway_route.go b/api/controller/apigateway/api_gateway_route.go index 35e243689..794806274 100644 --- a/api/controller/apigateway/api_gateway_route.go +++ b/api/controller/apigateway/api_gateway_route.go @@ -355,11 +355,6 @@ func (g Struct) CreateTCPRoute(w http.ResponseWriter, r *http.Request) { } serviceName := apisixRouteStream.Backend.ServiceName - name := serviceName - if r.URL.Query().Get("port") != "" { - name = fmt.Sprintf("%s-%s", serviceName, strings.ToLower(apisixRouteStream.Protocol)) - name = name + "-" + r.URL.Query().Get("port") - } logrus.Infof("apisixRouteStream.Match.IngressPort is %v", apisixRouteStream.Match.IngressPort) if apisixRouteStream.Match.IngressPort == 0 { logrus.Infof("change ingressPort") @@ -372,6 +367,7 @@ func (g Struct) CreateTCPRoute(w http.ResponseWriter, r *http.Request) { } apisixRouteStream.Match.IngressPort = int32(res) } + name := fmt.Sprintf("%v-%v", serviceName, apisixRouteStream.Match.IngressPort) spec := corev1.ServiceSpec{ Ports: []corev1.ServicePort{ {