Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,28 +248,6 @@ rules:
- get
- patch
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- grpcroutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- grpcroutes/finalizers
verbs:
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- grpcroutes/status
verbs:
- get
- patch
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
Expand Down
72 changes: 0 additions & 72 deletions controllers/gateway/eventhandlers/grpc_route_events.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ import (

// NewEnqueueRequestsForListenerRuleConfigurationEvent creates handler for ListenerRuleConfiguration resources
func NewEnqueueRequestsForListenerRuleConfigurationEvent(httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute],
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute], k8sClient client.Client, logger logr.Logger) handler.TypedEventHandler[*elbv2gw.ListenerRuleConfiguration, reconcile.Request] {
k8sClient client.Client, logger logr.Logger) handler.TypedEventHandler[*elbv2gw.ListenerRuleConfiguration, reconcile.Request] {
return &enqueueRequestsForListenerRuleConfigurationEvent{
httpRouteEventChan: httpRouteEventChan,
grpcRouteEventChan: grpcRouteEventChan,
k8sClient: k8sClient,
logger: logger,
}
Expand All @@ -29,7 +28,6 @@ var _ handler.TypedEventHandler[*elbv2gw.ListenerRuleConfiguration, reconcile.Re
// enqueueRequestsForListenerRuleConfigurationEvent handles ListenerRuleConfiguration events
type enqueueRequestsForListenerRuleConfigurationEvent struct {
httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute]
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute]
k8sClient client.Client
logger logr.Logger
}
Expand Down Expand Up @@ -76,14 +74,6 @@ func (h *enqueueRequestsForListenerRuleConfigurationEvent) enqueueImpactedRoutes
h.httpRouteEventChan <- event.TypedGenericEvent[*gatewayv1.HTTPRoute]{
Object: route.GetRawRoute().(*gatewayv1.HTTPRoute),
}
case routeutils.GRPCRouteKind:
h.logger.V(1).Info("enqueue grpcroute for listenerruleconfiguration event",
"listenerruleconfiguration", ruleConfig.Name,
"grpcroute", route.GetRouteNamespacedName())
h.grpcRouteEventChan <- event.TypedGenericEvent[*gatewayv1.GRPCRoute]{
Object: route.GetRawRoute().(*gatewayv1.GRPCRoute),
}
}
}

}
18 changes: 0 additions & 18 deletions controllers/gateway/eventhandlers/reference_grant_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ import (

// NewEnqueueRequestsForReferenceGrantEvent creates handler for ReferenceGrant resources
func NewEnqueueRequestsForReferenceGrantEvent(httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute],
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute],
tcpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TCPRoute],
udpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.UDPRoute],
tlsRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TLSRoute],
k8sClient client.Client, eventRecorder record.EventRecorder, logger logr.Logger) handler.TypedEventHandler[*gwbeta1.ReferenceGrant, reconcile.Request] {
return &enqueueRequestsForReferenceGrantEvent{
httpRouteEventChan: httpRouteEventChan,
grpcRouteEventChan: grpcRouteEventChan,
tcpRouteEventChan: tcpRouteEventChan,
udpRouteEventChan: udpRouteEventChan,
tlsRouteEventChan: tlsRouteEventChan,
Expand All @@ -40,7 +38,6 @@ var _ handler.TypedEventHandler[*gwbeta1.ReferenceGrant, reconcile.Request] = (*
// enqueueRequestsForReferenceGrantEvent handles ReferenceGrant events
type enqueueRequestsForReferenceGrantEvent struct {
httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute]
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute]
tcpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TCPRoute]
udpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.UDPRoute]
tlsRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TLSRoute]
Expand Down Expand Up @@ -105,21 +102,6 @@ func (h *enqueueRequestsForReferenceGrantEvent) enqueueImpactedRoutes(ctx contex
} else {
h.logger.Error(err, "Unable to list impacted http routes for reference grant event handler")
}
case string(routeutils.GRPCRouteKind):
if h.grpcRouteEventChan == nil {
continue
}
routes, err := routeutils.ListGRPCRoutes(ctx, h.k8sClient, &client.ListOptions{Namespace: string(impactedFrom.Namespace)})
if err == nil {
for _, route := range routes {
h.grpcRouteEventChan <- event.TypedGenericEvent[*gatewayv1.GRPCRoute]{
Object: route.GetRawRoute().(*gatewayv1.GRPCRoute),
}
}

} else {
h.logger.Error(err, "Unable to list impacted grpc routes for reference grant event handler")
}
case string(routeutils.TCPRouteKind):
if h.tcpRouteEventChan == nil {
continue
Expand Down
10 changes: 0 additions & 10 deletions controllers/gateway/eventhandlers/service_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ import (
// NewenqueueRequestsForServiceEvent detects changes to TargetGroupConfiguration and enqueues all gateway classes and gateways that
// would effected by a change in the TargetGroupConfiguration
func NewEnqueueRequestsForServiceEvent(httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute],
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute],
tcpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TCPRoute],
udpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.UDPRoute],
tlsRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TLSRoute], k8sClient client.Client, eventRecorder record.EventRecorder, logger logr.Logger, gwController string) handler.TypedEventHandler[*corev1.Service, reconcile.Request] {
return &enqueueRequestsForServiceEvent{
httpRouteEventChan: httpRouteEventChan,
grpcRouteEventChan: grpcRouteEventChan,
tcpRouteEventChan: tcpRouteEventChan,
udpRouteEventChan: udpRouteEventChan,
tlsRouteEventChan: tlsRouteEventChan,
Expand All @@ -40,7 +38,6 @@ var _ handler.TypedEventHandler[*corev1.Service, reconcile.Request] = (*enqueueR

type enqueueRequestsForServiceEvent struct {
httpRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.HTTPRoute]
grpcRouteEventChan chan<- event.TypedGenericEvent[*gatewayv1.GRPCRoute]
tcpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TCPRoute]
udpRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.UDPRoute]
tlsRouteEventChan chan<- event.TypedGenericEvent[*gwalpha2.TLSRoute]
Expand Down Expand Up @@ -143,13 +140,6 @@ func (h *enqueueRequestsForServiceEvent) enqueueImpactedL7Routes(
h.httpRouteEventChan <- event.TypedGenericEvent[*gatewayv1.HTTPRoute]{
Object: route.GetRawRoute().(*gatewayv1.HTTPRoute),
}
case routeutils.GRPCRouteKind:
h.logger.V(1).Info("enqueue grpcroute for service event",
"service", svc.Name,
"grpcroute", route.GetRouteNamespacedName())
h.grpcRouteEventChan <- event.TypedGenericEvent[*gatewayv1.GRPCRoute]{
Object: route.GetRawRoute().(*gatewayv1.GRPCRoute),
}
}
}
return
Expand Down
23 changes: 5 additions & 18 deletions controllers/gateway/gateway_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ type gatewayReconciler struct {
//+kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=httproutes/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=httproutes/finalizers,verbs=update

// +kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=grpcroutes,verbs=get;list;watch
// +kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=grpcroutes/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=grpcroutes/finalizers,verbs=update

func (r *gatewayReconciler) Reconcile(ctx context.Context, req reconcile.Request) (ctrl.Result, error) {
r.reconcileTracker(req.NamespacedName)
err := r.reconcileHelper(ctx, req)
Expand Down Expand Up @@ -484,18 +480,15 @@ func (r *gatewayReconciler) setupALBGatewayControllerWatches(ctrl controller.Con
tbConfigEventChan := make(chan event.TypedGenericEvent[*elbv2gw.TargetGroupConfiguration])
listenerRuleConfigEventChan := make(chan event.TypedGenericEvent[*elbv2gw.ListenerRuleConfiguration])
httpRouteEventChan := make(chan event.TypedGenericEvent[*gwv1.HTTPRoute])
grpcRouteEventChan := make(chan event.TypedGenericEvent[*gwv1.GRPCRoute])
svcEventChan := make(chan event.TypedGenericEvent[*corev1.Service])
tgConfigEventHandler := eventhandlers.NewEnqueueRequestsForTargetGroupConfigurationEvent(svcEventChan, r.k8sClient, r.eventRecorder,
loggerPrefix.WithName("TargetGroupConfiguration"))
listenerRuleConfigEventHandler := eventhandlers.NewEnqueueRequestsForListenerRuleConfigurationEvent(httpRouteEventChan, grpcRouteEventChan, r.k8sClient, loggerPrefix.WithName("ListenerRuleConfiguration"))
grpcRouteEventHandler := eventhandlers.NewEnqueueRequestsForGRPCRouteEvent(r.k8sClient, r.eventRecorder,
loggerPrefix.WithName("GRPCRoute"))
listenerRuleConfigEventHandler := eventhandlers.NewEnqueueRequestsForListenerRuleConfigurationEvent(httpRouteEventChan, r.k8sClient, loggerPrefix.WithName("ListenerRuleConfiguration"))
httpRouteEventHandler := eventhandlers.NewEnqueueRequestsForHTTPRouteEvent(r.k8sClient, r.eventRecorder,
loggerPrefix.WithName("HTTPRoute"))
svcEventHandler := eventhandlers.NewEnqueueRequestsForServiceEvent(httpRouteEventChan, grpcRouteEventChan, nil, nil, nil, r.k8sClient, r.eventRecorder,
svcEventHandler := eventhandlers.NewEnqueueRequestsForServiceEvent(httpRouteEventChan, nil, nil, nil, r.k8sClient, r.eventRecorder,
loggerPrefix.WithName("Service"), constants.ALBGatewayController)
refGrantHandler := eventhandlers.NewEnqueueRequestsForReferenceGrantEvent(httpRouteEventChan, grpcRouteEventChan, nil, nil, nil, r.k8sClient, r.eventRecorder,
refGrantHandler := eventhandlers.NewEnqueueRequestsForReferenceGrantEvent(httpRouteEventChan, nil, nil, nil, r.k8sClient, r.eventRecorder,
loggerPrefix.WithName("ReferenceGrant"))
if err := ctrl.Watch(source.Channel(tbConfigEventChan, tgConfigEventHandler)); err != nil {
return err
Expand All @@ -506,9 +499,6 @@ func (r *gatewayReconciler) setupALBGatewayControllerWatches(ctrl controller.Con
if err := ctrl.Watch(source.Channel(httpRouteEventChan, httpRouteEventHandler)); err != nil {
return err
}
if err := ctrl.Watch(source.Channel(grpcRouteEventChan, grpcRouteEventHandler)); err != nil {
return err
}
if err := ctrl.Watch(source.Channel(svcEventChan, svcEventHandler)); err != nil {
return err
}
Expand All @@ -527,9 +517,6 @@ func (r *gatewayReconciler) setupALBGatewayControllerWatches(ctrl controller.Con
if err := ctrl.Watch(source.Kind(mgr.GetCache(), &gwv1.HTTPRoute{}, httpRouteEventHandler)); err != nil {
return err
}
if err := ctrl.Watch(source.Kind(mgr.GetCache(), &gwv1.GRPCRoute{}, grpcRouteEventHandler)); err != nil {
return err
}
return nil
}

Expand All @@ -548,9 +535,9 @@ func (r *gatewayReconciler) setupNLBGatewayControllerWatches(ctrl controller.Con
loggerPrefix.WithName("UDPRoute"))
tlsRouteEventHandler := eventhandlers.NewEnqueueRequestsForTLSRouteEvent(r.k8sClient, r.eventRecorder,
loggerPrefix.WithName("TLSRoute"))
svcEventHandler := eventhandlers.NewEnqueueRequestsForServiceEvent(nil, nil, tcpRouteEventChan, udpRouteEventChan, tlsRouteEventChan, r.k8sClient, r.eventRecorder,
svcEventHandler := eventhandlers.NewEnqueueRequestsForServiceEvent(nil, tcpRouteEventChan, udpRouteEventChan, tlsRouteEventChan, r.k8sClient, r.eventRecorder,
loggerPrefix.WithName("Service"), constants.NLBGatewayController)
refGrantHandler := eventhandlers.NewEnqueueRequestsForReferenceGrantEvent(nil, nil, tcpRouteEventChan, udpRouteEventChan, tlsRouteEventChan, r.k8sClient, r.eventRecorder,
refGrantHandler := eventhandlers.NewEnqueueRequestsForReferenceGrantEvent(nil, tcpRouteEventChan, udpRouteEventChan, tlsRouteEventChan, r.k8sClient, r.eventRecorder,
loggerPrefix.WithName("ReferenceGrant"))
if err := ctrl.Watch(source.Channel(tbConfigEventChan, tgConfigEventHandler)); err != nil {
return err
Expand Down
13 changes: 0 additions & 13 deletions controllers/gateway/route_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ func (d *routeReconcilerImpl) handleRouteStatusUpdate(routeData routeutils.Route
switch routeKind {
case "HTTPRoute":
route = &gwv1.HTTPRoute{}
case "GRPCRoute":
route = &gwv1.GRPCRoute{}
case "UDPRoute":
route = &gwalpha2.UDPRoute{}
case "TCPRoute":
Expand Down Expand Up @@ -129,13 +127,6 @@ func (d *routeReconcilerImpl) updateRouteStatus(route client.Object, routeData r
}
originalRouteStatus = r.Status.Parents
ParentRefs = r.Spec.ParentRefs
case *gwv1.GRPCRoute:
controllerName = constants.ALBGatewayController
if r.Status.Parents == nil {
r.Status.Parents = []gwv1.RouteParentStatus{}
}
originalRouteStatus = r.Status.Parents
ParentRefs = r.Spec.ParentRefs
case *gwalpha2.UDPRoute:
if r.Status.Parents == nil {
r.Status.Parents = []gwv1.RouteParentStatus{}
Expand Down Expand Up @@ -195,8 +186,6 @@ func (d *routeReconcilerImpl) updateRouteStatus(route client.Object, routeData r
switch r := route.(type) {
case *gwv1.HTTPRoute:
r.Status.Parents = newRouteStatus
case *gwv1.GRPCRoute:
r.Status.Parents = newRouteStatus
case *gwalpha2.TLSRoute:
r.Status.Parents = newRouteStatus
case *gwalpha2.UDPRoute:
Expand Down Expand Up @@ -366,8 +355,6 @@ func getRouteStatus(route client.Object) []gwv1.RouteParentStatus {
switch r := route.(type) {
case *gwv1.HTTPRoute:
routeStatus = r.Status.Parents
case *gwv1.GRPCRoute:
routeStatus = r.Status.Parents
case *gwalpha2.TLSRoute:
routeStatus = r.Status.Parents
case *gwalpha2.UDPRoute:
Expand Down
22 changes: 1 addition & 21 deletions controllers/gateway/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,6 @@ func Test_generateRouteList(t *testing.T) {
name: "some routes",
routes: map[int32][]routeutils.RouteDescriptor{
1: {
&routeutils.MockRoute{
Name: "1-1-r",
Namespace: "1-1-ns",
Kind: routeutils.GRPCRouteKind,
},
&routeutils.MockRoute{
Name: "1-2-r",
Namespace: "1-2-ns",
Expand All @@ -734,11 +729,6 @@ func Test_generateRouteList(t *testing.T) {
},
},
2: {
&routeutils.MockRoute{
Name: "2-1-r",
Namespace: "2-1-ns",
Kind: routeutils.GRPCRouteKind,
},
&routeutils.MockRoute{
Name: "2-2-r",
Namespace: "2-2-ns",
Expand All @@ -756,11 +746,6 @@ func Test_generateRouteList(t *testing.T) {
},
},
3: {
&routeutils.MockRoute{
Name: "3-1-r",
Namespace: "3-1-ns",
Kind: routeutils.GRPCRouteKind,
},
&routeutils.MockRoute{
Name: "3-2-r",
Namespace: "3-2-ns",
Expand All @@ -778,11 +763,6 @@ func Test_generateRouteList(t *testing.T) {
},
},
4: {
&routeutils.MockRoute{
Name: "4-1-r",
Namespace: "4-1-ns",
Kind: routeutils.GRPCRouteKind,
},
&routeutils.MockRoute{
Name: "4-2-r",
Namespace: "4-2-ns",
Expand All @@ -800,7 +780,7 @@ func Test_generateRouteList(t *testing.T) {
},
},
},
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)",
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)",
},
}

Expand Down
Loading
Loading