You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by al...@apache.org on 2025/10/29 04:05:30 UTC

(apisix-ingress-controller) branch master updated: fix(ApisixRoute): failed to delete stream_route (#2624)

This is an automated email from the ASF dual-hosted git repository.

alinsran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new 36a3196e fix(ApisixRoute): failed to delete stream_route (#2624)
36a3196e is described below

commit 36a3196e58e14bcdcd643f99f3a3477eee76be46
Author: AlinsRan <al...@apache.org>
AuthorDate: Wed Oct 29 12:05:24 2025 +0800

    fix(ApisixRoute): failed to delete stream_route (#2624)
---
 internal/adc/translator/apisixroute.go |  1 +
 test/e2e/crds/v2/streamroute.go        | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/internal/adc/translator/apisixroute.go b/internal/adc/translator/apisixroute.go
index 1e130538..f5a509e1 100644
--- a/internal/adc/translator/apisixroute.go
+++ b/internal/adc/translator/apisixroute.go
@@ -486,6 +486,7 @@ func (t *Translator) translateStreamRule(tctx *provider.TranslateContext, ar *ap
 	svc.Name = adc.ComposeServiceNameWithStream(ar.Namespace, ar.Name, part.Name, part.Protocol)
 	svc.ID = id.GenID(svc.Name)
 	svc.StreamRoutes = append(svc.StreamRoutes, sr)
+	svc.Labels = label.GenLabel(ar)
 
 	upstream, err := t.translateApisixRouteStreamBackend(tctx, ar, part.Backend)
 	if err != nil {
diff --git a/test/e2e/crds/v2/streamroute.go b/test/e2e/crds/v2/streamroute.go
index 47c1c0d0..d06105c7 100644
--- a/test/e2e/crds/v2/streamroute.go
+++ b/test/e2e/crds/v2/streamroute.go
@@ -18,6 +18,7 @@
 package v2
 
 import (
+	"context"
 	"fmt"
 	"time"
 
@@ -86,6 +87,20 @@ spec:
 					scaffold.WithExpectedBodyContains("x-my-value"),
 				},
 			})
+
+			err = s.DeleteResourceFromString(fmt.Sprintf(apisixRoute, s.Namespace()))
+			Expect(err).ShouldNot(HaveOccurred(), "deleting ApisixRoute")
+
+			s.RetryAssertion(func() error {
+				svcs, err := s.DefaultDataplaneResource().Service().List(context.Background())
+				if err != nil {
+					return err
+				}
+				if len(svcs) != 0 {
+					return fmt.Errorf("expected 0 services, got %d", len(svcs))
+				}
+				return nil
+			}).ShouldNot(HaveOccurred(), "waiting for services to be deleted")
 		})
 	})