@@ -43,6 +43,7 @@ import (
4343 "github.com/apache/apisix-ingress-controller/internal/provider"
4444 internaltypes "github.com/apache/apisix-ingress-controller/internal/types"
4545 "github.com/apache/apisix-ingress-controller/internal/utils"
46+ pkgutils "github.com/apache/apisix-ingress-controller/pkg/utils"
4647)
4748
4849// GatewayReconciler reconciles a Gateway object.
@@ -83,18 +84,6 @@ func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager) error {
8384 & gatewayv1.GRPCRoute {},
8485 handler .EnqueueRequestsFromMapFunc (r .listGatewaysForStatusParentRefs ),
8586 ).
86- Watches (
87- & gatewayv1alpha2.TCPRoute {},
88- handler .EnqueueRequestsFromMapFunc (r .listGatewaysForStatusParentRefs ),
89- ).
90- Watches (
91- & gatewayv1alpha2.TLSRoute {},
92- handler .EnqueueRequestsFromMapFunc (r .listGatewaysForStatusParentRefs ),
93- ).
94- Watches (
95- & gatewayv1alpha2.UDPRoute {},
96- handler .EnqueueRequestsFromMapFunc (r .listGatewaysForStatusParentRefs ),
97- ).
9887 Watches (
9988 & v1alpha1.GatewayProxy {},
10089 handler .EnqueueRequestsFromMapFunc (r .listGatewaysForGatewayProxy ),
@@ -110,6 +99,24 @@ func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager) error {
11099 builder .WithPredicates (referenceGrantPredicates (KindGateway )),
111100 )
112101 }
102+ if pkgutils .HasAPIResource (mgr , & gatewayv1alpha2.TCPRoute {}) {
103+ bdr .Watches (
104+ & gatewayv1alpha2.TCPRoute {},
105+ handler .EnqueueRequestsFromMapFunc (r .listGatewaysForStatusParentRefs ),
106+ )
107+ }
108+ if pkgutils .HasAPIResource (mgr , & gatewayv1alpha2.TLSRoute {}) {
109+ bdr .Watches (
110+ & gatewayv1alpha2.TLSRoute {},
111+ handler .EnqueueRequestsFromMapFunc (r .listGatewaysForStatusParentRefs ),
112+ )
113+ }
114+ if pkgutils .HasAPIResource (mgr , & gatewayv1alpha2.UDPRoute {}) {
115+ bdr .Watches (
116+ & gatewayv1alpha2.UDPRoute {},
117+ handler .EnqueueRequestsFromMapFunc (r .listGatewaysForStatusParentRefs ),
118+ )
119+ }
113120
114121 return bdr .Complete (r )
115122}
0 commit comments