Avoid updating Accepted status for routes matching no Gateways
Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
parent
1508a2c221
commit
c441d04788
6 changed files with 164 additions and 96 deletions
|
@ -36,6 +36,11 @@ func (p *Provider) loadHTTPRoutes(ctx context.Context, gatewayListeners []gatewa
|
|||
Str("namespace", route.Namespace).
|
||||
Logger()
|
||||
|
||||
routeListeners := matchingGatewayListeners(gatewayListeners, route.Namespace, route.Spec.ParentRefs)
|
||||
if len(routeListeners) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
var parentStatuses []gatev1.RouteParentStatus
|
||||
for _, parentRef := range route.Spec.ParentRefs {
|
||||
parentStatus := &gatev1.RouteParentStatus{
|
||||
|
@ -52,11 +57,9 @@ func (p *Provider) loadHTTPRoutes(ctx context.Context, gatewayListeners []gatewa
|
|||
},
|
||||
}
|
||||
|
||||
for _, listener := range gatewayListeners {
|
||||
accepted := true
|
||||
if !matchListener(listener, route.Namespace, parentRef) {
|
||||
accepted = false
|
||||
}
|
||||
for _, listener := range routeListeners {
|
||||
accepted := matchListener(listener, parentRef)
|
||||
|
||||
if accepted && !allowRoute(listener, route.Namespace, kindHTTPRoute) {
|
||||
parentStatus.Conditions = updateRouteConditionAccepted(parentStatus.Conditions, string(gatev1.RouteReasonNotAllowedByListeners))
|
||||
accepted = false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue