Skip to content

Commit 23b0b65

Browse files
authored
Set ResolvedRefs condition to true on HTTPRoutes (#645)
Previously, the ResolvedRefs condition was only set to False on HTTPRoutes when one or more references could not be resolved. With this commit, ResolvedRefs will be set to true when all references are resolved.
1 parent 6186538 commit 23b0b65

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

docs/gateway-api-compatibility.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ Fields:
9999
* `conditions` - partially supported. Supported (Condition/Status/Reason):
100100
* `Accepted/True/Accepted`
101101
* `Accepted/False/NoMatchingListenerHostname`
102+
* `Accepted/False/UnsupportedValue`: Custom reason for when the HTTPRoute includes an invalid or unsupported value.
103+
* `Accepted/False/InvalidListener`: Custom reason for when the HTTPRoute references an invalid listener.
104+
* `ResolvedRefs/True/ResolvedRefs`
105+
* `ResolvedRefs/False/InvalidKind`
106+
* `ResolvedRefs/False/RefNotPermitted`
107+
* `ResolvedRefs/False/BackendNotFound`
108+
* `ResolvedRefs/False/UnsupportedValue`: Custom reason for when one of the HTTPRoute rules has a backendRef with an unsupported value.
102109

103110
### TLSRoute
104111

internal/state/change_processor_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,15 @@ var _ = Describe("ChangeProcessor", func() {
342342
SectionName: helpers.GetPointer[v1beta1.SectionName]("listener-80-1"),
343343
Conditions: []conditions.Condition{
344344
conditions.NewRouteInvalidListener(),
345+
conditions.NewRouteResolvedRefs(),
345346
},
346347
},
347348
{
348349
GatewayNsName: client.ObjectKeyFromObject(gw1),
349350
SectionName: helpers.GetPointer[v1beta1.SectionName]("listener-443-1"),
350351
Conditions: []conditions.Condition{
351352
conditions.NewRouteInvalidListener(),
353+
conditions.NewRouteResolvedRefs(),
352354
},
353355
},
354356
},

internal/state/conditions/conditions.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func DeduplicateConditions(conds []Condition) []Condition {
6868
func NewDefaultRouteConditions() []Condition {
6969
return []Condition{
7070
NewRouteAccepted(),
71+
NewRouteResolvedRefs(),
7172
}
7273
}
7374

@@ -294,6 +295,16 @@ func NewRouteBackendRefUnsupportedValue(msg string) Condition {
294295
}
295296
}
296297

298+
// NewRouteResolvedRefs returns a Condition that indicates that all the references on the Route are resolved.
299+
func NewRouteResolvedRefs() Condition {
300+
return Condition{
301+
Type: string(v1beta1.RouteConditionResolvedRefs),
302+
Status: metav1.ConditionTrue,
303+
Reason: string(v1beta1.RouteReasonResolvedRefs),
304+
Message: "All references are resolved",
305+
}
306+
}
307+
297308
// NewGatewayClassInvalidParameters returns a Condition that indicates that the GatewayClass has invalid parameters.
298309
func NewGatewayClassInvalidParameters(msg string) Condition {
299310
return Condition{

0 commit comments

Comments
 (0)