@@ -19,6 +19,7 @@ package controllers
1919import (
2020 "context"
2121 "fmt"
22+
2223 "sigs.k8s.io/controller-runtime/pkg/controller"
2324
2425 "github.com/pkg/errors"
@@ -50,7 +51,6 @@ import (
5051 "github.com/aws/aws-application-networking-k8s/pkg/k8s"
5152 "github.com/aws/aws-application-networking-k8s/pkg/model/core"
5253 lattice_runtime "github.com/aws/aws-application-networking-k8s/pkg/runtime"
53- "github.com/aws/aws-application-networking-k8s/pkg/utils"
5454 k8sutils "github.com/aws/aws-application-networking-k8s/pkg/utils"
5555 "github.com/aws/aws-application-networking-k8s/pkg/utils/gwlog"
5656)
@@ -85,16 +85,32 @@ func RegisterAllRouteControllers(
8585 mgr ctrl.Manager ,
8686) error {
8787 mgrClient := mgr .GetClient ()
88+
8889 gwEventHandler := eventhandlers .NewEnqueueRequestGatewayEvent (log , mgrClient )
8990 svcEventHandler := eventhandlers .NewServiceEventHandler (log , mgrClient )
9091
9192 routeInfos := []struct {
9293 routeType core.RouteType
9394 gatewayApiType client.Object
9495 }{
95- {core .HttpRouteType , & gwv1.HTTPRoute {}},
96- {core .GrpcRouteType , & gwv1.GRPCRoute {}},
97- {core .TlsRouteType , & gwv1alpha2.TLSRoute {}},
96+ {core .HttpRouteType , & gwv1.HTTPRoute {
97+ TypeMeta : metav1.TypeMeta {
98+ APIVersion : gwv1 .GroupVersion .String (),
99+ Kind : "HTTPRoute" ,
100+ },
101+ }},
102+ {core .GrpcRouteType , & gwv1.GRPCRoute {
103+ TypeMeta : metav1.TypeMeta {
104+ APIVersion : gwv1 .GroupVersion .String (),
105+ Kind : "GRPCRoute" ,
106+ },
107+ }},
108+ {core .TlsRouteType , & gwv1alpha2.TLSRoute {
109+ TypeMeta : metav1.TypeMeta {
110+ APIVersion : gwv1 .GroupVersion .String (),
111+ Kind : "TLSRoute" ,
112+ },
113+ }},
98114 }
99115
100116 for _ , routeInfo := range routeInfos {
@@ -169,7 +185,6 @@ func (r *routeReconciler) reconcile(ctx context.Context, req ctrl.Request) error
169185 if err != nil {
170186 return client .IgnoreNotFound (err )
171187 }
172-
173188 if err = r .client .Get (ctx , req .NamespacedName , route .K8sObject ()); err != nil {
174189 return client .IgnoreNotFound (err )
175190 }
@@ -261,8 +276,7 @@ func (r *routeReconciler) isRouteRelevant(ctx context.Context, route core.Route)
261276 // make sure gateway is an aws-vpc-lattice
262277 gwClass := & gwv1.GatewayClass {}
263278 gwClassName := types.NamespacedName {
264- Namespace : defaultNamespace ,
265- Name : string (gw .Spec .GatewayClassName ),
279+ Name : string (gw .Spec .GatewayClassName ),
266280 }
267281
268282 if err := r .client .Get (ctx , gwClassName , gwClass ); err != nil {
@@ -573,7 +587,7 @@ func (r *routeReconciler) validateRouteParentRefs(ctx context.Context, route cor
573587}
574588
575589// set of valid Kinds for Route Backend References
576- var validBackendKinds = utils .NewSet ("Service" , "ServiceImport" )
590+ var validBackendKinds = k8sutils .NewSet ("Service" , "ServiceImport" )
577591
578592// validate route's backed references, will return non-accepted
579593// condition if at least one backendRef not in a valid state
0 commit comments