Skip to content

Commit

Permalink
Add NewListenerInvalidRouteKinds condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ciarams87 committed Jun 28, 2023
1 parent 0d29b45 commit 67d12d0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/gateway-api-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Fields:
* `Programmed/False/Invalid`
* `ResolvedRefs/True/ResolvedRefs`
* `ResolvedRefs/False/InvalidCertificateRef`
* `ResolvedRefs/False/InvalidRouteKinds`
* `Conflicted/True/ProtocolConflict`
* `Conflicted/False/NoConflicts`

Expand Down
14 changes: 14 additions & 0 deletions internal/state/conditions/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/state/graph/gateway_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit 67d12d0

Please sign in to comment.