You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
When creating 2 Gateways with the same name in 2 different namespaces, and then create for each one HTTPRoute, only one of the routes will be attached to a gateway. The reason is that Gateway is selected only by parentRef name in case namespace is omitted. The expected behavior in case namespace is omitted is to select the gateway in the local namespace.
status:
parents:
- conditions:
- lastTransitionTime: "2024-07-16T20:36:36Z"message: Route is acceptedobservedGeneration: 1reason: Acceptedstatus: "True"type: Accepted
- lastTransitionTime: "2024-07-16T20:36:36Z"message: Resolved all the Object references for the RouteobservedGeneration: 1reason: ResolvedRefsstatus: "True"type: ResolvedRefscontrollerName: gateway.envoyproxy.io/gatewayclass-controllerparentRef:
group: gateway.networking.k8s.iokind: Gatewayname: eg
consumer2/backend HTTPRoute status:
status:
parents:
- conditions:
- lastTransitionTime: "2024-07-16T20:36:36Z"message: No listeners included by this parent ref allowed this attachment.observedGeneration: 1reason: NotAllowedByListenersstatus: "False"type: Accepted
- lastTransitionTime: "2024-07-16T20:36:36Z"message: Resolved all the Object references for the RouteobservedGeneration: 1reason: ResolvedRefsstatus: "True"type: ResolvedRefscontrollerName: gateway.envoyproxy.io/gatewayclass-controllerparentRef:
group: gateway.networking.k8s.iokind: Gatewayname: eg
Notice that both gateways name are eg.
When adding an explicit consumer2 namespace to consumer2/backend HTTPRoute parentRef the issue is resolved.
When looking at the code It seems like the root cause is in IsRefToGateway function:
Description:
When creating 2 Gateways with the same name in 2 different namespaces, and then create for each one HTTPRoute, only one of the routes will be attached to a gateway. The reason is that Gateway is selected only by parentRef name in case namespace is omitted. The expected behavior in case namespace is omitted is to select the gateway in the local namespace.
Repro steps:
Create a GatewayClass:
Create Gateway and HTTPRoute with
www.example.com
hostname inconsumer1
namespace:Create Gateway and HTTPRoute with
www.example2.com
hostname inconsumer2
namespace:consumer1/backend
HTTPRoute status:consumer2/backend
HTTPRoute status:eg
.consumer2
namespace toconsumer2/backend
HTTPRoute parentRef the issue is resolved.IsRefToGateway
function:gateway/internal/gatewayapi/helpers.go
Lines 121 to 123 in 85e57ae
When
parentRef.Namespace
is nil only name is being compared.A possible solution would be to add the route namespace in GetParentReferences to each parentRef with a missing namespace.
Environment:
Latest chart(v0.0.0-latest).
The text was updated successfully, but these errors were encountered: