66 // "fmt"
77
88 "github.com/go-logr/logr"
9- corev1 "k8s.io/api/core/v1"
109 v1 "k8s.io/api/core/v1"
1110 discoveryv1 "k8s.io/api/discovery/v1"
1211 apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -125,12 +124,12 @@ func NewUDPRouteController(mgr manager.Manager, ch event.EventChannel, log logr.
125124
126125 // watch Service objects referenced by one of our UDPRoutes
127126 if err := c .Watch (
128- source .Kind (mgr .GetCache (), & corev1 .Service {},
129- & handler.TypedEnqueueRequestForObject [* corev1 .Service ]{},
127+ source .Kind (mgr .GetCache (), & v1 .Service {},
128+ & handler.TypedEnqueueRequestForObject [* v1 .Service ]{},
130129 // trigger when either a gateway-loadbalancer service (svc annotated as a
131130 // related-service for a gateway) or a backend-service changes
132131 predicate .Or (
133- predicate.NewTypedPredicateFuncs [* corev1 .Service ](r .validateBackendServiceForReconcile ),
132+ predicate.NewTypedPredicateFuncs [* v1 .Service ](r .validateBackendServiceForReconcile ),
134133 loadBalancerPredicate )),
135134 ); err != nil {
136135 return nil , err
@@ -160,9 +159,9 @@ func NewUDPRouteController(mgr manager.Manager, ch event.EventChannel, log logr.
160159 // if EndpointSlices are still not available, fall back to wathing Endpoints
161160 if ! config .EndpointSliceAvailable {
162161 if err := c .Watch (
163- source .Kind (mgr .GetCache (), & corev1 .Endpoints {},
164- & handler.TypedEnqueueRequestForObject [* corev1 .Endpoints ]{},
165- predicate.NewTypedPredicateFuncs [* corev1 .Endpoints ](r .validateBackendEndpointsForReconcile )),
162+ source .Kind (mgr .GetCache (), & v1 .Endpoints {},
163+ & handler.TypedEnqueueRequestForObject [* v1 .Endpoints ]{},
164+ predicate.NewTypedPredicateFuncs [* v1 .Endpoints ](r .validateBackendEndpointsForReconcile )),
166165 ); err != nil {
167166 return nil , err
168167 }
@@ -204,7 +203,7 @@ func (r *udpRouteReconciler) Reconcile(ctx context.Context, req reconcile.Reques
204203
205204 // find all related-services that we use as LoadBalancers for Gateways (i.e., have label
206205 // "app:stunner")
207- svcs := & corev1 .ServiceList {}
206+ svcs := & v1 .ServiceList {}
208207 err := r .List (ctx , svcs , client.MatchingLabels {opdefault .OwnedByLabelKey : opdefault .OwnedByLabelValue })
209208 if err == nil {
210209 for _ , svc := range svcs .Items {
@@ -265,7 +264,7 @@ func (r *udpRouteReconciler) Reconcile(ctx context.Context, req reconcile.Reques
265264
266265 nsName := udproute .GetNamespace ()
267266 r .log .V (2 ).Info ("Looking for the namespace of UDPRoute" , "name" , nsName )
268- namespace := corev1 .Namespace {}
267+ namespace := v1 .Namespace {}
269268 if err := r .Get (ctx , types.NamespacedName {Name : nsName }, & namespace ); err != nil {
270269 r .log .Error (err , "Error getting namespace for UDPRoute" , "udproute" ,
271270 store .GetObjectKey (& udproute ), "namespace-name" , nsName )
@@ -325,7 +324,7 @@ func (r *udpRouteReconciler) Reconcile(ctx context.Context, req reconcile.Reques
325324
326325 nsName := udproute .GetNamespace ()
327326 r .log .V (2 ).Info ("Looking for the namespace of UDPRoute" , "name" , nsName )
328- namespace := corev1 .Namespace {}
327+ namespace := v1 .Namespace {}
329328 if err := r .Get (ctx , types.NamespacedName {Name : nsName }, & namespace ); err != nil {
330329 r .log .Error (err , "Error getting namespace for UDPRoute" , "udproute" ,
331330 store .GetObjectKey (udproute ), "namespace-name" , nsName )
@@ -363,15 +362,15 @@ func (r *udpRouteReconciler) Reconcile(ctx context.Context, req reconcile.Reques
363362 return reconcile.Result {}, nil
364363}
365364
366- func (r * udpRouteReconciler ) validateBackendServiceForReconcile (svc * corev1 .Service ) bool {
365+ func (r * udpRouteReconciler ) validateBackendServiceForReconcile (svc * v1 .Service ) bool {
367366 return r .validateBackendForReconcile (store .GetObjectKey (svc ))
368367}
369368
370369func (r * udpRouteReconciler ) validateStaticServiceForReconcile (svc * stnrgwv1.StaticService ) bool {
371370 return r .validateBackendForReconcile (store .GetObjectKey (svc ))
372371}
373372
374- func (r * udpRouteReconciler ) validateBackendEndpointsForReconcile (e * corev1 .Endpoints ) bool {
373+ func (r * udpRouteReconciler ) validateBackendEndpointsForReconcile (e * v1 .Endpoints ) bool {
375374 return r .validateBackendForReconcile (store .GetObjectKey (e ))
376375}
377376
@@ -417,7 +416,7 @@ func (r *udpRouteReconciler) validateEndpointSliceForReconcile(esl *discoveryv1.
417416
418417 // r.log.Info("validateEndpointSliceForReconcile:", "label", "ok")
419418
420- svc := & corev1 .Service {}
419+ svc := & v1 .Service {}
421420 if err := r .Get (context .Background (), types.NamespacedName {
422421 Namespace : esl .GetNamespace (),
423422 Name : svcName ,
@@ -435,7 +434,7 @@ func (r *udpRouteReconciler) validateEndpointSliceForReconcile(esl *discoveryv1.
435434}
436435
437436// getServiceForBackend finds the Service associated with a backendRef
438- func (r * udpRouteReconciler ) getServiceForBackend (ctx context.Context , udproute * stnrgwv1.UDPRoute , ref * stnrgwv1.BackendRef ) * corev1 .Service {
437+ func (r * udpRouteReconciler ) getServiceForBackend (ctx context.Context , udproute * stnrgwv1.UDPRoute , ref * stnrgwv1.BackendRef ) * v1 .Service {
439438
440439 // if no explicit Service namespace is provided, use the UDPRoute namespace to lookup the
441440 // Service
@@ -444,7 +443,7 @@ func (r *udpRouteReconciler) getServiceForBackend(ctx context.Context, udproute
444443 namespace = string (* ref .Namespace )
445444 }
446445
447- svc := corev1 .Service {}
446+ svc := v1 .Service {}
448447 if err := r .Get (ctx ,
449448 types.NamespacedName {Namespace : namespace , Name : string (ref .Name )},
450449 & svc ,
@@ -511,7 +510,7 @@ func (r *udpRouteReconciler) getEndpointsForBackend(ctx context.Context, udprout
511510 namespace = string (* ref .Namespace )
512511 }
513512
514- ep := corev1 .Endpoints {}
513+ ep := v1 .Endpoints {}
515514 if err := r .Get (ctx , types.NamespacedName {Namespace : namespace , Name : string (ref .Name )}, & ep ); err != nil {
516515 // not fatal
517516 if ! apierrors .IsNotFound (err ) {
0 commit comments