@@ -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"
@@ -116,14 +117,11 @@ func RegisterAllRouteControllers(
116117 for _ , routeInfo := range routeInfos {
117118 gv := routeInfo .gatewayApiType .GetObjectKind ().GroupVersionKind ().GroupVersion ().String ()
118119 kind := routeInfo .gatewayApiType .GetObjectKind ().GroupVersionKind ().Kind
119- fmt .Printf ("GVK: %s, %s" , gv , kind )
120120 log .Infof (context .TODO (), "GVK: %s, %s" , gv , kind )
121121 if ok , err := k8s .IsGVKSupported (mgr , gv , kind ); ! ok {
122122 log .Infof (context .TODO (), "GVK not supported gv: %s, kind: %s" , gv , kind )
123- fmt .Printf ("GVK not supported gv: %s, kind: %s" , gv , kind )
124123 if err != nil {
125124 log .Infof (context .TODO (), "GVK not supported error: %s" , err )
126- fmt .Printf ("GVK not supported error: %s" , err )
127125 return nil
128126 }
129127 } else {
@@ -203,6 +201,7 @@ func (r *routeReconciler) reconcile(ctx context.Context, req ctrl.Request) error
203201 if err != nil {
204202 return client .IgnoreNotFound (err )
205203 }
204+ r .log .Debugw (ctx , "u-kai reconcile after getRoute" , "route" , route )
206205
207206 if err = r .client .Get (ctx , req .NamespacedName , route .K8sObject ()); err != nil {
208207 return client .IgnoreNotFound (err )
@@ -389,25 +388,6 @@ func (r *routeReconciler) reconcileUpsert(ctx context.Context, req ctrl.Request,
389388 return backendRefIPFamiliesErr
390389 }
391390
392- if _ , err := r .buildAndDeployModel (ctx , route ); err != nil {
393- if services .IsConflictError (err ) {
394- // Stop reconciliation of this route if the route cannot be owned / has conflict
395- route .Status ().UpdateParentRefs (route .Spec ().ParentRefs ()[0 ], config .LatticeGatewayControllerName )
396- route .Status ().UpdateRouteCondition (metav1.Condition {
397- Type : string (gwv1 .RouteConditionAccepted ),
398- Status : metav1 .ConditionFalse ,
399- ObservedGeneration : route .K8sObject ().GetGeneration (),
400- Reason : "Conflicted" ,
401- Message : err .Error (),
402- })
403- if err = r .client .Status ().Update (ctx , route .K8sObject ()); err != nil {
404- return fmt .Errorf ("failed to update route status for conflict due to err %w" , err )
405- }
406- return nil
407- }
408- return err
409- }
410-
411391 r .eventRecorder .Event (route .K8sObject (), corev1 .EventTypeNormal ,
412392 k8s .RouteEventReasonDeploySucceed , "Adding/Updating reconcile Done!" )
413393
@@ -574,6 +554,20 @@ func (r *routeReconciler) validateRouteParentRefs(ctx context.Context, route cor
574554 if gw == nil {
575555 continue // ignore status update if gw not found
576556 }
557+ gwClass := & gwv1.GatewayClass {}
558+ gwClassName := types.NamespacedName {
559+ Namespace : defaultNamespace ,
560+ Name : string (gw .Spec .GatewayClassName ),
561+ }
562+ err = r .client .Get (ctx , gwClassName , gwClass )
563+ if err != nil {
564+ r .ukaiLog (ctx , "Ignore Route not controlled by any GatewayClass %s, %s" , route .Name (), route .Namespace ())
565+ continue
566+ }
567+ if gwClass .Spec .ControllerName != config .LatticeGatewayControllerName {
568+ r .ukaiLog (ctx , "Ignore non aws-vpc-lattice Route %s, %s" , route .Name (), route .Namespace ())
569+ continue
570+ }
577571
578572 noMatchingParent := true
579573 for _ , listener := range gw .Spec .Listeners {
@@ -605,6 +599,9 @@ func (r *routeReconciler) validateRouteParentRefs(ctx context.Context, route cor
605599
606600 return parentStatuses , nil
607601}
602+ func (r * routeReconciler ) ukaiLog (ctx context.Context , template string , args ... interface {}) {
603+ r .log .Infof (ctx , "u-kai: " + template , args ... )
604+ }
608605
609606// set of valid Kinds for Route Backend References
610607var validBackendKinds = utils .NewSet ("Service" , "ServiceImport" )
0 commit comments