From 6729ae9d2954372d68c3d61eb826b46e490a49c5 Mon Sep 17 00:00:00 2001 From: Guy Daich Date: Mon, 6 Jan 2025 13:58:04 -0600 Subject: [PATCH] check if httproutefilter crd exists Signed-off-by: Guy Daich --- internal/provider/kubernetes/routes.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/internal/provider/kubernetes/routes.go b/internal/provider/kubernetes/routes.go index 8395e0eb573b..1dd2afe5ea58 100644 --- a/internal/provider/kubernetes/routes.go +++ b/internal/provider/kubernetes/routes.go @@ -404,15 +404,17 @@ func (r *gatewayAPIReconciler) processHTTPRoutes(ctx context.Context, gatewayNam switch string(filter.ExtensionRef.Kind) { case egv1a1.KindHTTPRouteFilter: - httpFilter, err := r.getHTTPRouteFilter(ctx, key.Name, key.Namespace) - if err != nil { - r.log.Error(err, "HTTPRouteFilters not found; bypassing rule", "index", i) - continue - } - if !resourceMap.allAssociatedHTTPRouteExtensionFilters.Has(key) { - r.processRouteFilterConfigMapRef(ctx, httpFilter, resourceMap, resourceTree) - resourceMap.allAssociatedHTTPRouteExtensionFilters.Insert(key) - resourceTree.HTTPRouteFilters = append(resourceTree.HTTPRouteFilters, httpFilter) + if r.hrfCRDExists { + httpFilter, err := r.getHTTPRouteFilter(ctx, key.Name, key.Namespace) + if err != nil { + r.log.Error(err, "HTTPRouteFilters not found; bypassing rule", "index", i) + continue + } + if !resourceMap.allAssociatedHTTPRouteExtensionFilters.Has(key) { + r.processRouteFilterConfigMapRef(ctx, httpFilter, resourceMap, resourceTree) + resourceMap.allAssociatedHTTPRouteExtensionFilters.Insert(key) + resourceTree.HTTPRouteFilters = append(resourceTree.HTTPRouteFilters, httpFilter) + } } default: extRefFilter, ok := resourceMap.extensionRefFilters[key]