From f6d0b407011af2bce1cdc49cd2c264412abfd191 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: Mon, 16 Dec 2024 17:47:34 +0800 Subject: [PATCH] fix: not delete route and svc (#2098) 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 | 1 + api/controller/resources.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/api/controller/apigateway/api_gateway_route.go b/api/controller/apigateway/api_gateway_route.go index 3a2b0d5b2..35e243689 100644 --- a/api/controller/apigateway/api_gateway_route.go +++ b/api/controller/apigateway/api_gateway_route.go @@ -425,6 +425,7 @@ func (g Struct) CreateTCPRoute(w http.ResponseWriter, r *http.Request) { // Service doesn't exist, create a new one logrus.Infof("Service %s does not exist, creating a new service", name) labels := make(map[string]string) + labels["creator"] = "Rainbond" labels["tcp"] = "true" labels["app_id"] = r.URL.Query().Get("appID") labels["service_id"] = r.URL.Query().Get("service_id") diff --git a/api/controller/resources.go b/api/controller/resources.go index bb0961456..60141a605 100644 --- a/api/controller/resources.go +++ b/api/controller/resources.go @@ -1015,7 +1015,7 @@ func (t *TenantStruct) DeleteSingleServiceInfo(w http.ResponseWriter, r *http.Re service := r.Context().Value(ctxutil.ContextKey("service")).(*dbmodel.TenantServices) err := k8s.Default().ApiSixClient.ApisixV2().ApisixRoutes(tenant.Namespace).DeleteCollection(r.Context(), v1.DeleteOptions{}, v1.ListOptions{ - LabelSelector: "service_alias=" + service.ServiceAlias, + LabelSelector: service.ServiceAlias + "service_alias=", }) if err != nil { logrus.Errorf("delete apisix route error: %v", err)