diff --git a/CHANGELOG.md b/CHANGELOG.md index 77faeb80eb..6b9340b104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -138,6 +138,10 @@ Adding a new version? You'll need three changes: - Fixed Kong client status check causing unnecessary `config update failed` errors and `KongConfigurationApplyFailed` events being generated. [#6689](https://github.com/Kong/kubernetes-ingress-controller/pull/6689) +- Do not emit error logs when group and kind of `parentRef` in a route does not + point to a `Gateway` as they can point to other kinds of resources like + `Service` when used in service mesh solutions. + [#6692](https://github.com/Kong/kubernetes-ingress-controller/pull/6692) ### Added diff --git a/internal/controllers/gateway/route_predicates.go b/internal/controllers/gateway/route_predicates.go index 1e1ee73dd8..0f7fca58a7 100644 --- a/internal/controllers/gateway/route_predicates.go +++ b/internal/controllers/gateway/route_predicates.go @@ -67,9 +67,8 @@ func IsRouteAttachedToReconciledGateway[routeT gatewayapi.RouteT]( if parentRef.Group != nil { group = string(*parentRef.Group) } - - switch { - case kind == "Gateway" && group == gatewayapi.GroupVersion.Group: + // Check the parent gateway if the parentRef points to a gateway that is possible to be controlled by KIC. + if kind == "Gateway" && group == gatewayapi.GroupVersion.Group { var gateway gatewayapi.Gateway err := cl.Get(context.Background(), k8stypes.NamespacedName{Namespace: namespace, Name: string(parentRef.Name)}, &gateway) if err != nil { @@ -87,13 +86,9 @@ func IsRouteAttachedToReconciledGateway[routeT gatewayapi.RouteT]( if isGatewayClassControlled(&gatewayClass) { return true } - default: - log.Error( - fmt.Errorf("unsupported parentRef kind %s and group %s", kind, group), - "Got an unexpected kind and group when checking route's parentRefs", - ) - return false } + // REVIEW: should we directly return false here if parentRef points to a non-Gateway object (like `Service`)? + // This means we do not reconcile the route when it is attaching to some non-Gateway parent, like using it for service mesh. } return false