Skip to content

Commit b322ce1

Browse files
authored
Add NewListenerInvalidRouteKinds condition (#799)
1 parent 0d29b45 commit b322ce1

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

docs/gateway-api-compatibility.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Fields:
9393
* `Programmed/False/Invalid`
9494
* `ResolvedRefs/True/ResolvedRefs`
9595
* `ResolvedRefs/False/InvalidCertificateRef`
96+
* `ResolvedRefs/False/InvalidRouteKinds`
9697
* `Conflicted/True/ProtocolConflict`
9798
* `Conflicted/False/NoConflicts`
9899

internal/state/conditions/conditions.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,20 @@ func NewListenerInvalidCertificateRef(msg string) []Condition {
348348
}
349349
}
350350

351+
// NewListenerInvalidRouteKinds returns Conditions that indicate that an invalid or unsupported Route kind is
352+
// specified by the Listener.
353+
func NewListenerInvalidRouteKinds(msg string) []Condition {
354+
return []Condition{
355+
{
356+
Type: string(v1beta1.ListenerReasonResolvedRefs),
357+
Status: metav1.ConditionFalse,
358+
Reason: string(v1beta1.ListenerReasonInvalidRouteKinds),
359+
Message: msg,
360+
},
361+
NewListenerNotProgrammedInvalid(msg),
362+
}
363+
}
364+
351365
// NewListenerProtocolConflict returns Conditions that indicate multiple Listeners are specified with the same
352366
// Listener port number, but have conflicting protocol specifications.
353367
func NewListenerProtocolConflict(msg string) []Condition {

internal/state/graph/gateway_listener.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func validateListenerAllowedRouteKind(listener v1beta1.Listener) []conditions.Co
223223
for _, kind := range listener.AllowedRoutes.Kinds {
224224
if !validHTTPRouteKind(kind) {
225225
msg := fmt.Sprintf("Unsupported route kind \"%s/%s\"", *kind.Group, kind.Kind)
226-
return conditions.NewListenerUnsupportedValue(msg)
226+
return conditions.NewListenerInvalidRouteKinds(msg)
227227
}
228228
}
229229
}

0 commit comments

Comments
 (0)