Skip to content

Commit 4b5844e

Browse files
authored
re introduce grpc routes (#4318)
* fix doc statement * Revert "fix http / grpc route rule generation (#4316)" This reverts commit 2bebac5. * re-add grpc routes
1 parent 2bebac5 commit 4b5844e

28 files changed

+1830
-46
lines changed

config/rbac/role.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,28 @@ rules:
248248
- get
249249
- patch
250250
- update
251+
- apiGroups:
252+
- gateway.networking.k8s.io
253+
resources:
254+
- grpcroutes
255+
verbs:
256+
- get
257+
- list
258+
- watch
259+
- apiGroups:
260+
- gateway.networking.k8s.io
261+
resources:
262+
- grpcroutes/finalizers
263+
verbs:
264+
- update
265+
- apiGroups:
266+
- gateway.networking.k8s.io
267+
resources:
268+
- grpcroutes/status
269+
verbs:
270+
- get
271+
- patch
272+
- update
251273
- apiGroups:
252274
- gateway.networking.k8s.io
253275
resources:
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package eventhandlers
2+
3+
import (
4+
"context"
5+
"github.com/go-logr/logr"
6+
"k8s.io/client-go/tools/record"
7+
"k8s.io/client-go/util/workqueue"
8+
"sigs.k8s.io/aws-load-balancer-controller/pkg/gateway/constants"
9+
"sigs.k8s.io/aws-load-balancer-controller/pkg/gateway/gatewayutils"
10+
"sigs.k8s.io/aws-load-balancer-controller/pkg/k8s"
11+
"sigs.k8s.io/controller-runtime/pkg/client"
12+
"sigs.k8s.io/controller-runtime/pkg/event"
13+
"sigs.k8s.io/controller-runtime/pkg/handler"
14+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
15+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
16+
)
17+
18+
// NewEnqueueRequestsForGRPCRouteEvent creates handler for GRPCRoute resources
19+
func NewEnqueueRequestsForGRPCRouteEvent(
20+
k8sClient client.Client, eventRecorder record.EventRecorder, logger logr.Logger) handler.TypedEventHandler[*gatewayv1.GRPCRoute, reconcile.Request] {
21+
return &enqueueRequestsForGRPCRouteEvent{
22+
k8sClient: k8sClient,
23+
eventRecorder: eventRecorder,
24+
logger: logger,
25+
}
26+
}
27+
28+
var _ handler.TypedEventHandler[*gatewayv1.GRPCRoute, reconcile.Request] = (*enqueueRequestsForGRPCRouteEvent)(nil)
29+
30+
// enqueueRequestsForGRPCRouteEvent handles GRPCRoute events
31+
type enqueueRequestsForGRPCRouteEvent struct {
32+
k8sClient client.Client
33+
eventRecorder record.EventRecorder
34+
logger logr.Logger
35+
}
36+
37+
func (h *enqueueRequestsForGRPCRouteEvent) Create(ctx context.Context, e event.TypedCreateEvent[*gatewayv1.GRPCRoute], queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
38+
routeNew := e.Object
39+
h.logger.V(1).Info("enqueue grpcroute create event", "grpcroute", routeNew.Name)
40+
h.enqueueImpactedGateways(ctx, routeNew, queue)
41+
}
42+
43+
func (h *enqueueRequestsForGRPCRouteEvent) Update(ctx context.Context, e event.TypedUpdateEvent[*gatewayv1.GRPCRoute], queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
44+
routeNew := e.ObjectNew
45+
h.logger.V(1).Info("enqueue grpcroute update event", "grpcroute", routeNew.Name)
46+
h.enqueueImpactedGateways(ctx, routeNew, queue)
47+
}
48+
49+
func (h *enqueueRequestsForGRPCRouteEvent) Delete(ctx context.Context, e event.TypedDeleteEvent[*gatewayv1.GRPCRoute], queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
50+
route := e.Object
51+
h.logger.V(1).Info("enqueue grpcroute delete event", "grpcroute", route.Name)
52+
h.enqueueImpactedGateways(ctx, route, queue)
53+
}
54+
55+
func (h *enqueueRequestsForGRPCRouteEvent) Generic(ctx context.Context, e event.TypedGenericEvent[*gatewayv1.GRPCRoute], queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
56+
route := e.Object
57+
h.logger.V(1).Info("enqueue grpcroute generic event", "grpcroute", route.Name)
58+
h.enqueueImpactedGateways(ctx, route, queue)
59+
}
60+
61+
func (h *enqueueRequestsForGRPCRouteEvent) enqueueImpactedGateways(ctx context.Context, route *gatewayv1.GRPCRoute, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
62+
gateways, err := gatewayutils.GetImpactedGatewaysFromParentRefs(ctx, h.k8sClient, route.Spec.ParentRefs, route.Status.Parents, route.Namespace, constants.ALBGatewayController)
63+
if err != nil {
64+
h.logger.V(1).Info("ignoring unknown gateways referred by", "grpcroute", route.Name, "error", err)
65+
}
66+
for _, gw := range gateways {
67+
h.logger.V(1).Info("enqueue gateway for grpcroute event",
68+
"grpcroute", k8s.NamespacedName(route),
69+
"gateway", gw)
70+
queue.Add(reconcile.Request{NamespacedName: gw})
71+
}
72+
}

controllers/gateway/eventhandlers/listener_rule_configuration_events.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ import (
1515

1616
// NewEnqueueRequestsForListenerRuleConfigurationEvent creates handler for ListenerRuleConfiguration resources
1717
func NewEnqueueRequestsForListenerRuleConfigurationEvent(httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute],
18-
k8sClient client.Client, logger logr.Logger) handler.TypedEventHandler[*elbv2gw.ListenerRuleConfiguration, reconcile.Request] {
18+
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute], k8sClient client.Client, logger logr.Logger) handler.TypedEventHandler[*elbv2gw.ListenerRuleConfiguration, reconcile.Request] {
1919
return &enqueueRequestsForListenerRuleConfigurationEvent{
2020
httpRouteEventChan: httpRouteEventChan,
21+
grpcRouteEventChan: grpcRouteEventChan,
2122
k8sClient: k8sClient,
2223
logger: logger,
2324
}
@@ -28,6 +29,7 @@ var _ handler.TypedEventHandler[*elbv2gw.ListenerRuleConfiguration, reconcile.Re
2829
// enqueueRequestsForListenerRuleConfigurationEvent handles ListenerRuleConfiguration events
2930
type enqueueRequestsForListenerRuleConfigurationEvent struct {
3031
httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute]
32+
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute]
3133
k8sClient client.Client
3234
logger logr.Logger
3335
}
@@ -74,6 +76,14 @@ func (h *enqueueRequestsForListenerRuleConfigurationEvent) enqueueImpactedRoutes
7476
h.httpRouteEventChan <- event.TypedGenericEvent[*gatewayv1.HTTPRoute]{
7577
Object: route.GetRawRoute().(*gatewayv1.HTTPRoute),
7678
}
79+
case routeutils.GRPCRouteKind:
80+
h.logger.V(1).Info("enqueue grpcroute for listenerruleconfiguration event",
81+
"listenerruleconfiguration", ruleConfig.Name,
82+
"grpcroute", route.GetRouteNamespacedName())
83+
h.grpcRouteEventChan <- event.TypedGenericEvent[*gatewayv1.GRPCRoute]{
84+
Object: route.GetRawRoute().(*gatewayv1.GRPCRoute),
85+
}
7786
}
7887
}
88+
7989
}

controllers/gateway/eventhandlers/reference_grant_events.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ import (
1818

1919
// NewEnqueueRequestsForReferenceGrantEvent creates handler for ReferenceGrant resources
2020
func NewEnqueueRequestsForReferenceGrantEvent(httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute],
21+
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute],
2122
tcpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TCPRoute],
2223
udpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.UDPRoute],
2324
tlsRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TLSRoute],
2425
k8sClient client.Client, eventRecorder record.EventRecorder, logger logr.Logger) handler.TypedEventHandler[*gwbeta1.ReferenceGrant, reconcile.Request] {
2526
return &enqueueRequestsForReferenceGrantEvent{
2627
httpRouteEventChan: httpRouteEventChan,
28+
grpcRouteEventChan: grpcRouteEventChan,
2729
tcpRouteEventChan: tcpRouteEventChan,
2830
udpRouteEventChan: udpRouteEventChan,
2931
tlsRouteEventChan: tlsRouteEventChan,
@@ -38,6 +40,7 @@ var _ handler.TypedEventHandler[*gwbeta1.ReferenceGrant, reconcile.Request] = (*
3840
// enqueueRequestsForReferenceGrantEvent handles ReferenceGrant events
3941
type enqueueRequestsForReferenceGrantEvent struct {
4042
httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute]
43+
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute]
4144
tcpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TCPRoute]
4245
udpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.UDPRoute]
4346
tlsRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TLSRoute]
@@ -102,6 +105,21 @@ func (h *enqueueRequestsForReferenceGrantEvent) enqueueImpactedRoutes(ctx contex
102105
} else {
103106
h.logger.Error(err, "Unable to list impacted http routes for reference grant event handler")
104107
}
108+
case string(routeutils.GRPCRouteKind):
109+
if h.grpcRouteEventChan == nil {
110+
continue
111+
}
112+
routes, err := routeutils.ListGRPCRoutes(ctx, h.k8sClient, &client.ListOptions{Namespace: string(impactedFrom.Namespace)})
113+
if err == nil {
114+
for _, route := range routes {
115+
h.grpcRouteEventChan <- event.TypedGenericEvent[*gatewayv1.GRPCRoute]{
116+
Object: route.GetRawRoute().(*gatewayv1.GRPCRoute),
117+
}
118+
}
119+
120+
} else {
121+
h.logger.Error(err, "Unable to list impacted grpc routes for reference grant event handler")
122+
}
105123
case string(routeutils.TCPRouteKind):
106124
if h.tcpRouteEventChan == nil {
107125
continue

controllers/gateway/eventhandlers/service_events.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ import (
1919
// NewenqueueRequestsForServiceEvent detects changes to TargetGroupConfiguration and enqueues all gateway classes and gateways that
2020
// would effected by a change in the TargetGroupConfiguration
2121
func NewEnqueueRequestsForServiceEvent(httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute],
22+
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute],
2223
tcpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TCPRoute],
2324
udpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.UDPRoute],
2425
tlsRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TLSRoute], k8sClient client.Client, eventRecorder record.EventRecorder, logger logr.Logger, gwController string) handler.TypedEventHandler[*corev1.Service, reconcile.Request] {
2526
return &enqueueRequestsForServiceEvent{
2627
httpRouteEventChan: httpRouteEventChan,
28+
grpcRouteEventChan: grpcRouteEventChan,
2729
tcpRouteEventChan: tcpRouteEventChan,
2830
udpRouteEventChan: udpRouteEventChan,
2931
tlsRouteEventChan: tlsRouteEventChan,
@@ -38,6 +40,7 @@ var _ handler.TypedEventHandler[*corev1.Service, reconcile.Request] = (*enqueueR
3840

3941
type enqueueRequestsForServiceEvent struct {
4042
httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute]
43+
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute]
4144
tcpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TCPRoute]
4245
udpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.UDPRoute]
4346
tlsRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TLSRoute]
@@ -140,6 +143,13 @@ func (h *enqueueRequestsForServiceEvent) enqueueImpactedL7Routes(
140143
h.httpRouteEventChan <- event.TypedGenericEvent[*gatewayv1.HTTPRoute]{
141144
Object: route.GetRawRoute().(*gatewayv1.HTTPRoute),
142145
}
146+
case routeutils.GRPCRouteKind:
147+
h.logger.V(1).Info("enqueue grpcroute for service event",
148+
"service", svc.Name,
149+
"grpcroute", route.GetRouteNamespacedName())
150+
h.grpcRouteEventChan <- event.TypedGenericEvent[*gatewayv1.GRPCRoute]{
151+
Object: route.GetRawRoute().(*gatewayv1.GRPCRoute),
152+
}
143153
}
144154
}
145155
return

controllers/gateway/gateway_controller.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ type gatewayReconciler struct {
164164
//+kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=httproutes/status,verbs=get;update;patch
165165
//+kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=httproutes/finalizers,verbs=update
166166

167+
// +kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=grpcroutes,verbs=get;list;watch
168+
// +kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=grpcroutes/status,verbs=get;update;patch
169+
// +kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=grpcroutes/finalizers,verbs=update
170+
167171
func (r *gatewayReconciler) Reconcile(ctx context.Context, req reconcile.Request) (ctrl.Result, error) {
168172
r.reconcileTracker(req.NamespacedName)
169173
err := r.reconcileHelper(ctx, req)
@@ -480,15 +484,18 @@ func (r *gatewayReconciler) setupALBGatewayControllerWatches(ctrl controller.Con
480484
tbConfigEventChan := make(chan event.TypedGenericEvent[*elbv2gw.TargetGroupConfiguration])
481485
listenerRuleConfigEventChan := make(chan event.TypedGenericEvent[*elbv2gw.ListenerRuleConfiguration])
482486
httpRouteEventChan := make(chan event.TypedGenericEvent[*gwv1.HTTPRoute])
487+
grpcRouteEventChan := make(chan event.TypedGenericEvent[*gwv1.GRPCRoute])
483488
svcEventChan := make(chan event.TypedGenericEvent[*corev1.Service])
484489
tgConfigEventHandler := eventhandlers.NewEnqueueRequestsForTargetGroupConfigurationEvent(svcEventChan, r.k8sClient, r.eventRecorder,
485490
loggerPrefix.WithName("TargetGroupConfiguration"))
486-
listenerRuleConfigEventHandler := eventhandlers.NewEnqueueRequestsForListenerRuleConfigurationEvent(httpRouteEventChan, r.k8sClient, loggerPrefix.WithName("ListenerRuleConfiguration"))
491+
listenerRuleConfigEventHandler := eventhandlers.NewEnqueueRequestsForListenerRuleConfigurationEvent(httpRouteEventChan, grpcRouteEventChan, r.k8sClient, loggerPrefix.WithName("ListenerRuleConfiguration"))
492+
grpcRouteEventHandler := eventhandlers.NewEnqueueRequestsForGRPCRouteEvent(r.k8sClient, r.eventRecorder,
493+
loggerPrefix.WithName("GRPCRoute"))
487494
httpRouteEventHandler := eventhandlers.NewEnqueueRequestsForHTTPRouteEvent(r.k8sClient, r.eventRecorder,
488495
loggerPrefix.WithName("HTTPRoute"))
489-
svcEventHandler := eventhandlers.NewEnqueueRequestsForServiceEvent(httpRouteEventChan, nil, nil, nil, r.k8sClient, r.eventRecorder,
496+
svcEventHandler := eventhandlers.NewEnqueueRequestsForServiceEvent(httpRouteEventChan, grpcRouteEventChan, nil, nil, nil, r.k8sClient, r.eventRecorder,
490497
loggerPrefix.WithName("Service"), constants.ALBGatewayController)
491-
refGrantHandler := eventhandlers.NewEnqueueRequestsForReferenceGrantEvent(httpRouteEventChan, nil, nil, nil, r.k8sClient, r.eventRecorder,
498+
refGrantHandler := eventhandlers.NewEnqueueRequestsForReferenceGrantEvent(httpRouteEventChan, grpcRouteEventChan, nil, nil, nil, r.k8sClient, r.eventRecorder,
492499
loggerPrefix.WithName("ReferenceGrant"))
493500
if err := ctrl.Watch(source.Channel(tbConfigEventChan, tgConfigEventHandler)); err != nil {
494501
return err
@@ -499,6 +506,9 @@ func (r *gatewayReconciler) setupALBGatewayControllerWatches(ctrl controller.Con
499506
if err := ctrl.Watch(source.Channel(httpRouteEventChan, httpRouteEventHandler)); err != nil {
500507
return err
501508
}
509+
if err := ctrl.Watch(source.Channel(grpcRouteEventChan, grpcRouteEventHandler)); err != nil {
510+
return err
511+
}
502512
if err := ctrl.Watch(source.Channel(svcEventChan, svcEventHandler)); err != nil {
503513
return err
504514
}
@@ -517,6 +527,9 @@ func (r *gatewayReconciler) setupALBGatewayControllerWatches(ctrl controller.Con
517527
if err := ctrl.Watch(source.Kind(mgr.GetCache(), &gwv1.HTTPRoute{}, httpRouteEventHandler)); err != nil {
518528
return err
519529
}
530+
if err := ctrl.Watch(source.Kind(mgr.GetCache(), &gwv1.GRPCRoute{}, grpcRouteEventHandler)); err != nil {
531+
return err
532+
}
520533
return nil
521534
}
522535

@@ -535,9 +548,9 @@ func (r *gatewayReconciler) setupNLBGatewayControllerWatches(ctrl controller.Con
535548
loggerPrefix.WithName("UDPRoute"))
536549
tlsRouteEventHandler := eventhandlers.NewEnqueueRequestsForTLSRouteEvent(r.k8sClient, r.eventRecorder,
537550
loggerPrefix.WithName("TLSRoute"))
538-
svcEventHandler := eventhandlers.NewEnqueueRequestsForServiceEvent(nil, tcpRouteEventChan, udpRouteEventChan, tlsRouteEventChan, r.k8sClient, r.eventRecorder,
551+
svcEventHandler := eventhandlers.NewEnqueueRequestsForServiceEvent(nil, nil, tcpRouteEventChan, udpRouteEventChan, tlsRouteEventChan, r.k8sClient, r.eventRecorder,
539552
loggerPrefix.WithName("Service"), constants.NLBGatewayController)
540-
refGrantHandler := eventhandlers.NewEnqueueRequestsForReferenceGrantEvent(nil, tcpRouteEventChan, udpRouteEventChan, tlsRouteEventChan, r.k8sClient, r.eventRecorder,
553+
refGrantHandler := eventhandlers.NewEnqueueRequestsForReferenceGrantEvent(nil, nil, tcpRouteEventChan, udpRouteEventChan, tlsRouteEventChan, r.k8sClient, r.eventRecorder,
541554
loggerPrefix.WithName("ReferenceGrant"))
542555
if err := ctrl.Watch(source.Channel(tbConfigEventChan, tgConfigEventHandler)); err != nil {
543556
return err

controllers/gateway/route_reconciler.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ func (d *routeReconcilerImpl) handleRouteStatusUpdate(routeData routeutils.Route
8484
switch routeKind {
8585
case "HTTPRoute":
8686
route = &gwv1.HTTPRoute{}
87+
case "GRPCRoute":
88+
route = &gwv1.GRPCRoute{}
8789
case "UDPRoute":
8890
route = &gwalpha2.UDPRoute{}
8991
case "TCPRoute":
@@ -127,6 +129,13 @@ func (d *routeReconcilerImpl) updateRouteStatus(route client.Object, routeData r
127129
}
128130
originalRouteStatus = r.Status.Parents
129131
ParentRefs = r.Spec.ParentRefs
132+
case *gwv1.GRPCRoute:
133+
controllerName = constants.ALBGatewayController
134+
if r.Status.Parents == nil {
135+
r.Status.Parents = []gwv1.RouteParentStatus{}
136+
}
137+
originalRouteStatus = r.Status.Parents
138+
ParentRefs = r.Spec.ParentRefs
130139
case *gwalpha2.UDPRoute:
131140
if r.Status.Parents == nil {
132141
r.Status.Parents = []gwv1.RouteParentStatus{}
@@ -186,6 +195,8 @@ func (d *routeReconcilerImpl) updateRouteStatus(route client.Object, routeData r
186195
switch r := route.(type) {
187196
case *gwv1.HTTPRoute:
188197
r.Status.Parents = newRouteStatus
198+
case *gwv1.GRPCRoute:
199+
r.Status.Parents = newRouteStatus
189200
case *gwalpha2.TLSRoute:
190201
r.Status.Parents = newRouteStatus
191202
case *gwalpha2.UDPRoute:
@@ -355,6 +366,8 @@ func getRouteStatus(route client.Object) []gwv1.RouteParentStatus {
355366
switch r := route.(type) {
356367
case *gwv1.HTTPRoute:
357368
routeStatus = r.Status.Parents
369+
case *gwv1.GRPCRoute:
370+
routeStatus = r.Status.Parents
358371
case *gwalpha2.TLSRoute:
359372
routeStatus = r.Status.Parents
360373
case *gwalpha2.UDPRoute:

controllers/gateway/utils_test.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,11 @@ func Test_generateRouteList(t *testing.T) {
712712
name: "some routes",
713713
routes: map[int32][]routeutils.RouteDescriptor{
714714
1: {
715+
&routeutils.MockRoute{
716+
Name: "1-1-r",
717+
Namespace: "1-1-ns",
718+
Kind: routeutils.GRPCRouteKind,
719+
},
715720
&routeutils.MockRoute{
716721
Name: "1-2-r",
717722
Namespace: "1-2-ns",
@@ -729,6 +734,11 @@ func Test_generateRouteList(t *testing.T) {
729734
},
730735
},
731736
2: {
737+
&routeutils.MockRoute{
738+
Name: "2-1-r",
739+
Namespace: "2-1-ns",
740+
Kind: routeutils.GRPCRouteKind,
741+
},
732742
&routeutils.MockRoute{
733743
Name: "2-2-r",
734744
Namespace: "2-2-ns",
@@ -746,6 +756,11 @@ func Test_generateRouteList(t *testing.T) {
746756
},
747757
},
748758
3: {
759+
&routeutils.MockRoute{
760+
Name: "3-1-r",
761+
Namespace: "3-1-ns",
762+
Kind: routeutils.GRPCRouteKind,
763+
},
749764
&routeutils.MockRoute{
750765
Name: "3-2-r",
751766
Namespace: "3-2-ns",
@@ -763,6 +778,11 @@ func Test_generateRouteList(t *testing.T) {
763778
},
764779
},
765780
4: {
781+
&routeutils.MockRoute{
782+
Name: "4-1-r",
783+
Namespace: "4-1-ns",
784+
Kind: routeutils.GRPCRouteKind,
785+
},
766786
&routeutils.MockRoute{
767787
Name: "4-2-r",
768788
Namespace: "4-2-ns",
@@ -780,7 +800,7 @@ func Test_generateRouteList(t *testing.T) {
780800
},
781801
},
782802
},
783-
expected: "(HTTPRoute, 1-3-ns:1-3-r),(HTTPRoute, 2-3-ns:2-3-r),(HTTPRoute, 3-3-ns:3-3-r),(HTTPRoute, 4-3-ns:4-3-r),(TCPRoute, 1-2-ns:1-2-r),(TCPRoute, 2-2-ns:2-2-r),(TCPRoute, 3-2-ns:3-2-r),(TCPRoute, 4-2-ns:4-2-r),(UDPRoute, 1-4-ns:1-4-r),(UDPRoute, 2-4-ns:2-4-r),(UDPRoute, 3-4-ns:3-4-r),(UDPRoute, 4-4-ns:4-4-r)",
803+
expected: "(GRPCRoute, 1-1-ns:1-1-r),(GRPCRoute, 2-1-ns:2-1-r),(GRPCRoute, 3-1-ns:3-1-r),(GRPCRoute, 4-1-ns:4-1-r),(HTTPRoute, 1-3-ns:1-3-r),(HTTPRoute, 2-3-ns:2-3-r),(HTTPRoute, 3-3-ns:3-3-r),(HTTPRoute, 4-3-ns:4-3-r),(TCPRoute, 1-2-ns:1-2-r),(TCPRoute, 2-2-ns:2-2-r),(TCPRoute, 3-2-ns:3-2-r),(TCPRoute, 4-2-ns:4-2-r),(UDPRoute, 1-4-ns:1-4-r),(UDPRoute, 2-4-ns:2-4-r),(UDPRoute, 3-4-ns:3-4-r),(UDPRoute, 4-4-ns:4-4-r)",
784804
},
785805
}
786806

0 commit comments

Comments
 (0)