Skip to content

Commit 4439c4a

Browse files
committed
add e2e tests, remove route validator
1 parent f556ffb commit 4439c4a

File tree

7 files changed

+190
-356
lines changed

7 files changed

+190
-356
lines changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ func main() {
278278
enabledControllers := sets.Set[string]{}
279279

280280
routeLoaderCreator := sync.OnceValue(func() routeutils.Loader {
281-
return routeutils.NewLoader(mgr.GetClient(), routeReconciler, routeutils.NewRouteValidator(), mgr.GetLogger().WithName("gateway-route-loader"))
281+
return routeutils.NewLoader(mgr.GetClient(), routeReconciler, mgr.GetLogger().WithName("gateway-route-loader"))
282282
})
283283

284284
// Setup NLB Gateway controller if enabled

pkg/gateway/routeutils/loader.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,15 @@ type loaderImpl struct {
6565
routeSubmitter RouteReconcilerSubmitter
6666
k8sClient client.Client
6767
logger logr.Logger
68-
routeValidator RouteValidator
6968
allRouteLoaders map[RouteKind]func(context context.Context, client client.Client, opts ...client.ListOption) ([]preLoadRouteDescriptor, error)
7069
}
7170

72-
func NewLoader(k8sClient client.Client, routeSubmitter RouteReconcilerSubmitter, routeValidator RouteValidator, logger logr.Logger) Loader {
71+
func NewLoader(k8sClient client.Client, routeSubmitter RouteReconcilerSubmitter, logger logr.Logger) Loader {
7372
return &loaderImpl{
7473
mapper: newListenerToRouteMapper(k8sClient, logger.WithName("route-mapper")),
7574
routeSubmitter: routeSubmitter,
7675
k8sClient: k8sClient,
7776
allRouteLoaders: allRoutes,
78-
routeValidator: routeValidator,
7977
logger: logger,
8078
}
8179
}
@@ -117,13 +115,9 @@ func (l *loaderImpl) LoadRoutesForGateway(ctx context.Context, gw gwv1.Gateway,
117115
// 2. Validate listeners configuration and get listener status
118116
listenerValidationResults := ValidateListeners(gw, controllerName, ctx, l.k8sClient)
119117

120-
// 3. Validate route configuration, filter out bad configurations.
121-
validatedRoutes, validationErrors := l.routeValidator.filterToValidRoutes(gw, foo)
122-
routeStatusUpdates = append(routeStatusUpdates, validationErrors...)
123-
124-
// 4. Remove routes that aren't granted attachment by the listener.
118+
// 3. Remove routes that aren't granted attachment by the listener.
125119
// Map any routes that are granted attachment to the listener port that allows the attachment.
126-
mappedRoutes, statusUpdates, err := l.mapper.mapGatewayAndRoutes(ctx, gw, validatedRoutes)
120+
mappedRoutes, statusUpdates, err := l.mapper.mapGatewayAndRoutes(ctx, gw, foo)
127121

128122
routeStatusUpdates = append(routeStatusUpdates, statusUpdates...)
129123

@@ -134,7 +128,7 @@ func (l *loaderImpl) LoadRoutesForGateway(ctx context.Context, gw gwv1.Gateway,
134128
// Count attached routes per listener for listener status update
135129
attachedRouteMap := buildAttachedRouteMap(gw, mappedRoutes)
136130

137-
// 5. Load the underlying resource(s) for each route that is configured.
131+
// 4. Load the underlying resource(s) for each route that is configured.
138132
loadedRoute, childRouteLoadUpdates, err := l.loadChildResources(ctx, mappedRoutes, gw)
139133
routeStatusUpdates = append(routeStatusUpdates, childRouteLoadUpdates...)
140134
if err != nil {

pkg/gateway/routeutils/loader_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ func TestLoadRoutesForGateway(t *testing.T) {
299299
mapToReturn: tc.expectedPreloadMap,
300300
routeStatusUpdates: tc.mapperRouteStatusUpdates,
301301
},
302-
routeValidator: NewRouteValidator(),
303302
allRouteLoaders: allRouteLoaders,
304303
logger: logr.Discard(),
305304
routeSubmitter: routeReconciler,

pkg/gateway/routeutils/route_validator.go

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)