Skip to content

Commit e9c3ac5

Browse files
authored
fix(status): separate listener programmed state from HTTPRoute Accepted condition (#9129)
* fix(status): separate listener programmed state from HTTPRoute Accepted condition Remove the NoReadyListeners block that set Accepted: False on routes when no listeners were programmed. Route acceptance reflects binding validity; listener programmed state is already tracked by the listener's own conditions. Signed-off-by: apkatsikas <[email protected]> * fix(status): separate listener programmed state from TCPRoute/UDPRoute Accepted condition Routes with a valid binding to an unprogrammed listener now correctly reach Accepted=True regardless of listener readiness. Moves accepted=true and IncrementAttachedRoutes before the IsReady check so the Accepted condition reflects binding validity only, consistent with the HTTPRoute fix and the Gateway API spec. Signed-off-by: apkatsikas <[email protected]>
1 parent b96a2d3 commit e9c3ac5

25 files changed

Lines changed: 65 additions & 337 deletions

File tree

internal/gatewayapi/helpers.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,6 @@ func isRefToListenerSet(parentRef gwapiv1.ParentReference) bool {
203203
return false
204204
}
205205

206-
// HasReadyListener returns true if at least one Listener in the
207-
// provided list has a condition of "Ready: true", and false otherwise.
208-
func HasReadyListener(listeners []*ListenerContext) bool {
209-
for _, listener := range listeners {
210-
if listener.IsReady() {
211-
return true
212-
}
213-
}
214-
return false
215-
}
216-
217206
// ValidateHTTPRouteFilter validates the provided filter within HTTPRoute.
218207
func ValidateHTTPRouteFilter(filter *gwapiv1.HTTPRouteFilter, extGKs ...schema.GroupKind) error {
219208
switch {

internal/gatewayapi/route.go

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,11 +1625,11 @@ func (t *Translator) processUDPRouteParentRefs(udpRoute *UDPRouteContext, resour
16251625
if listener.AttachedRoutes() >= 1 {
16261626
continue
16271627
}
1628+
accepted = true
16281629
listener.IncrementAttachedRoutes()
16291630
if !listener.IsReady() {
16301631
continue
16311632
}
1632-
accepted = true
16331633

16341634
irKey := t.getIRKey(listener.gateway.Gateway)
16351635

@@ -1777,12 +1777,11 @@ func (t *Translator) processTCPRouteParentRefs(tcpRoute *TCPRouteContext, resour
17771777
if listener.AttachedRoutes() >= 1 {
17781778
continue
17791779
}
1780+
accepted = true
1781+
listener.IncrementAttachedRoutes()
17801782
if !listener.IsReady() {
17811783
continue
17821784
}
1783-
listener.IncrementAttachedRoutes()
1784-
1785-
accepted = true
17861785
irKey := t.getIRKey(listener.gateway.Gateway)
17871786

17881787
gwXdsIR := xdsIR[irKey]
@@ -2300,19 +2299,6 @@ func (t *Translator) processAllowedListenersForParentRefs(
23002299
}
23012300
parentRefCtx.SetListeners(allowedListeners...)
23022301

2303-
if !HasReadyListener(allowedListeners) {
2304-
routeStatus := GetRouteStatus(routeContext)
2305-
status.SetRouteStatusCondition(routeStatus,
2306-
parentRefCtx.routeParentStatusIdx,
2307-
routeContext.GetGeneration(),
2308-
gwapiv1.RouteConditionAccepted,
2309-
metav1.ConditionFalse,
2310-
"NoReadyListeners",
2311-
"There are no ready listeners for this parent ref",
2312-
)
2313-
continue
2314-
}
2315-
23162302
routeStatus := GetRouteStatus(routeContext)
23172303
status.SetRouteStatusCondition(routeStatus,
23182304
parentRefCtx.routeParentStatusIdx,

internal/gatewayapi/testdata/backendtrafficpolicy-with-routing-type-listener.out.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ httpRoutes:
199199
parents:
200200
- conditions:
201201
- lastTransitionTime: null
202-
message: There are no ready listeners for this parent ref
203-
reason: NoReadyListeners
204-
status: "False"
202+
message: Route is accepted
203+
reason: Accepted
204+
status: "True"
205205
type: Accepted
206206
- lastTransitionTime: null
207207
message: Resolved all the Object references for the Route

internal/gatewayapi/testdata/gateway-with-attached-routes.out.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ httpRoutes:
276276
parents:
277277
- conditions:
278278
- lastTransitionTime: null
279-
message: There are no ready listeners for this parent ref
280-
reason: NoReadyListeners
281-
status: "False"
279+
message: Route is accepted
280+
reason: Accepted
281+
status: "True"
282282
type: Accepted
283283
- lastTransitionTime: null
284284
message: 'Failed to process route rule 0 backendRef 0: service envoy-gateway/does-not-exist

internal/gatewayapi/testdata/gateway-with-listener-with-invalid-allowed-routes-kind-and-supported.out.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ httpRoutes:
5555
parents:
5656
- conditions:
5757
- lastTransitionTime: null
58-
message: There are no ready listeners for this parent ref
59-
reason: NoReadyListeners
60-
status: "False"
58+
message: Route is accepted
59+
reason: Accepted
60+
status: "True"
6161
type: Accepted
6262
- lastTransitionTime: null
6363
message: Resolved all the Object references for the Route

internal/gatewayapi/testdata/gateway-with-listener-with-invalid-tls-configuration-invalid-mode.out.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ httpRoutes:
5959
parents:
6060
- conditions:
6161
- lastTransitionTime: null
62-
message: There are no ready listeners for this parent ref
63-
reason: NoReadyListeners
64-
status: "False"
62+
message: Route is accepted
63+
reason: Accepted
64+
status: "True"
6565
type: Accepted
6666
- lastTransitionTime: null
6767
message: Resolved all the Object references for the Route

internal/gatewayapi/testdata/gateway-with-listener-with-invalid-tls-configuration-no-certificate-refs.out.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ httpRoutes:
5656
parents:
5757
- conditions:
5858
- lastTransitionTime: null
59-
message: There are no ready listeners for this parent ref
60-
reason: NoReadyListeners
61-
status: "False"
59+
message: Route is accepted
60+
reason: Accepted
61+
status: "True"
6262
type: Accepted
6363
- lastTransitionTime: null
6464
message: Resolved all the Object references for the Route

internal/gatewayapi/testdata/gateway-with-listener-with-invalid-tls-configuration-secret-does-not-exist.out.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ httpRoutes:
6464
parents:
6565
- conditions:
6666
- lastTransitionTime: null
67-
message: There are no ready listeners for this parent ref
68-
reason: NoReadyListeners
69-
status: "False"
67+
message: Route is accepted
68+
reason: Accepted
69+
status: "True"
7070
type: Accepted
7171
- lastTransitionTime: null
7272
message: Resolved all the Object references for the Route

internal/gatewayapi/testdata/gateway-with-listener-with-invalid-tls-configuration-secret-in-other-namespace.out.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ httpRoutes:
6060
parents:
6161
- conditions:
6262
- lastTransitionTime: null
63-
message: There are no ready listeners for this parent ref
64-
reason: NoReadyListeners
65-
status: "False"
63+
message: Route is accepted
64+
reason: Accepted
65+
status: "True"
6666
type: Accepted
6767
- lastTransitionTime: null
6868
message: Resolved all the Object references for the Route

internal/gatewayapi/testdata/gateway-with-listener-with-invalid-tls-configuration-secret-is-not-valid.out.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ httpRoutes:
6464
parents:
6565
- conditions:
6666
- lastTransitionTime: null
67-
message: There are no ready listeners for this parent ref
68-
reason: NoReadyListeners
69-
status: "False"
67+
message: Route is accepted
68+
reason: Accepted
69+
status: "True"
7070
type: Accepted
7171
- lastTransitionTime: null
7272
message: Resolved all the Object references for the Route

0 commit comments

Comments
 (0)