gateway
gateway copied to clipboard
Update Gateway Listener Condition When HTTPRoute is Deleted
https://github.com/envoyproxy/gateway/pull/395 added support for surfacing listener conditions to gateways. When an httproute is deleted, the attachedRoutes
of the references gateway is updated but not the Gateway's listen condition. For example:
listeners:
- attachedRoutes: 0
conditions:
- lastTransitionTime: "2022-09-22T17:37:06Z"
message: Listener is ready
observedGeneration: 1
reason: Ready
status: "True"
type: Ready
name: http
supportedKinds:
- group: gateway.networking.k8s.io
kind: HTTPRoute
The status logic of the gatewayapi translator should be updated to support this use case. xref: https://github.com/envoyproxy/gateway/blob/70a0d3caeb0e8e4cf90fc913b79eab18d7733e67/internal/gatewayapi/translator.go#L382
cc: @skriss @arkodg
@skriss is this is bug or working as expected ?
@danehans what exactly are you saying should be updated that is not? The "ready" condition shouldn't be affected by if there are routes attached or not.
@skriss when a gatewayclass and gateway are created, the gateway status shows no listener conditions until a httproute is created. When the same httproute is deleted, the attachedRoutes
are updated to 0
and the listener condition is what I described above. Shouldn't we have consistent behavior for creating/deleting an httproute, e.g. delete the listener and update the associated condition? In the example above, the http
listener condition was surfaced after the httproute was created/attached so it should be removed when the route is removed or the listener should be created when the gateway listener is created and removed when the gateway listener is removed.
Ah, yeah I think the ListenerStatus should probably get filled in when the Gateway is created, irrespective of whether there are routes attached or not. If that's not happening then that's probably the thing to fix here.
from @skriss 's comments it sounds like attachedRoutes
is mutually exclusive to the Listener Ready status so this is a non issue
No, the ListenerStatus should be filled in when the Gateway is processed, regardless of its value. The attachedRoutes
is intended to be a lightweight check of how many Routes are attached (putting all the Route details in creates fan-out update problems).
Let me try to re-test this today, I think it might be fixed as a result of some of the other PRs that have since been merged.
Running through the quickstart using the hot-off-the-presses v0.2.0-rc.2:
Just after creating the Gateway, I see:
listeners:
- attachedRoutes: 0
conditions:
- lastTransitionTime: "2022-09-30T16:51:55Z"
message: Listener is ready
observedGeneration: 1
reason: Ready
status: "True"
type: Ready
name: http
supportedKinds:
- group: gateway.networking.k8s.io
kind: HTTPRoute
After creating the HTTPRoute, I see:
listeners:
- attachedRoutes: 1
conditions:
- lastTransitionTime: "2022-09-30T16:51:55Z"
message: Listener is ready
observedGeneration: 1
reason: Ready
status: "True"
type: Ready
name: http
supportedKinds:
- group: gateway.networking.k8s.io
kind: HTTPRoute
I then delete the HTTPRoute, and see:
listeners:
- attachedRoutes: 0
conditions:
- lastTransitionTime: "2022-09-30T16:51:55Z"
message: Listener is ready
observedGeneration: 1
reason: Ready
status: "True"
type: Ready
name: http
supportedKinds:
- group: gateway.networking.k8s.io
kind: HTTPRoute
This all looks right to me and seems to working as expected. @danehans, if you agree, then let's close this out.
Agreed. Thanks for checking on this @skriss.