diff --git a/docs/gateway-api-compatibility.md b/docs/gateway-api-compatibility.md index 9e64aa7a18..4b1b4ef2ae 100644 --- a/docs/gateway-api-compatibility.md +++ b/docs/gateway-api-compatibility.md @@ -93,6 +93,7 @@ Fields: * `Programmed/False/Invalid` * `ResolvedRefs/True/ResolvedRefs` * `ResolvedRefs/False/InvalidCertificateRef` + * `ResolvedRefs/False/InvalidRouteKinds` * `Conflicted/True/ProtocolConflict` * `Conflicted/False/NoConflicts` diff --git a/internal/state/conditions/conditions.go b/internal/state/conditions/conditions.go index 1dc04c95de..b1e64ef23f 100644 --- a/internal/state/conditions/conditions.go +++ b/internal/state/conditions/conditions.go @@ -348,6 +348,20 @@ func NewListenerInvalidCertificateRef(msg string) []Condition { } } +// NewListenerInvalidRouteKinds returns Conditions that indicate that an invalid or unsupported Route kind is +// specified by the Listener. +func NewListenerInvalidRouteKinds(msg string) []Condition { + return []Condition{ + { + Type: string(v1beta1.ListenerReasonResolvedRefs), + Status: metav1.ConditionFalse, + Reason: string(v1beta1.ListenerReasonInvalidRouteKinds), + Message: msg, + }, + NewListenerNotProgrammedInvalid(msg), + } +} + // NewListenerProtocolConflict returns Conditions that indicate multiple Listeners are specified with the same // Listener port number, but have conflicting protocol specifications. func NewListenerProtocolConflict(msg string) []Condition { diff --git a/internal/state/graph/gateway_listener.go b/internal/state/graph/gateway_listener.go index f743625e97..87512dd727 100644 --- a/internal/state/graph/gateway_listener.go +++ b/internal/state/graph/gateway_listener.go @@ -223,7 +223,7 @@ func validateListenerAllowedRouteKind(listener v1beta1.Listener) []conditions.Co for _, kind := range listener.AllowedRoutes.Kinds { if !validHTTPRouteKind(kind) { msg := fmt.Sprintf("Unsupported route kind \"%s/%s\"", *kind.Group, kind.Kind) - return conditions.NewListenerUnsupportedValue(msg) + return conditions.NewListenerInvalidRouteKinds(msg) } } }