Skip to content

Commit

Permalink
Fix attachedRoutes computation
Browse files Browse the repository at this point in the history
* Fixes: #2077
* Fixes: #1916

Signed-off-by: Arko Dasgupta <[email protected]>
  • Loading branch information
arkodg committed Oct 27, 2023
1 parent c3ee960 commit c1fda33
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
17 changes: 5 additions & 12 deletions internal/gatewayapi/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,8 @@ func (t *Translator) processHTTPRouteParentRefListener(route RouteContext, route
// Theoretically there should only be one parent ref per
// Route that attaches to a given Listener, so fine to just increment here, but we
// might want to check to ensure we're not double-counting.
if len(routeRoutes) > 0 {
listener.IncrementAttachedRoutes()
}
listener.IncrementAttachedRoutes()

}

return hasHostnameIntersection
Expand Down Expand Up @@ -691,9 +690,7 @@ func (t *Translator) processTLSRouteParentRefs(tlsRoute *TLSRouteContext, resour
// Theoretically there should only be one parent ref per
// Route that attaches to a given Listener, so fine to just increment here, but we
// might want to check to ensure we're not double-counting.
if len(irListener.Destination.Settings) > 0 {
listener.IncrementAttachedRoutes()
}
listener.IncrementAttachedRoutes()
}

if !hasHostnameIntersection {
Expand Down Expand Up @@ -828,9 +825,7 @@ func (t *Translator) processUDPRouteParentRefs(udpRoute *UDPRouteContext, resour
// Theoretically there should only be one parent ref per
// Route that attaches to a given Listener, so fine to just increment here, but we
// might want to check to ensure we're not double-counting.
if len(irListener.Destination.Settings) > 0 {
listener.IncrementAttachedRoutes()
}
listener.IncrementAttachedRoutes()
}

// If no negative conditions have been set, the route is considered "Accepted=True".
Expand Down Expand Up @@ -965,9 +960,7 @@ func (t *Translator) processTCPRouteParentRefs(tcpRoute *TCPRouteContext, resour
// Theoretically there should only be one parent ref per
// Route that attaches to a given Listener, so fine to just increment here, but we
// might want to check to ensure we're not double-counting.
if len(irListener.Destination.Settings) > 0 {
listener.IncrementAttachedRoutes()
}
listener.IncrementAttachedRoutes()
}

// If no negative conditions have been set, the route is considered "Accepted=True".
Expand Down
1 change: 0 additions & 1 deletion test/conformance/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func TestGatewayAPIConformance(t *testing.T) {
SkipTests: []string{
tests.HTTPRouteRewritePath.ShortName,
tests.GatewayStaticAddresses.ShortName,
tests.GatewayWithAttachedRoutes.ShortName,
tests.HTTPRouteBackendProtocolH2C.ShortName,
},
ExemptFeatures: suite.MeshCoreFeatures,
Expand Down
1 change: 0 additions & 1 deletion test/conformance/experimental_conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func experimentalConformance(t *testing.T) {
SkipTests: []string{
tests.HTTPRouteRewritePath.ShortName,
tests.GatewayStaticAddresses.ShortName,
tests.GatewayWithAttachedRoutes.ShortName,
tests.HTTPRouteBackendProtocolH2C.ShortName,
},
ExemptFeatures: suite.MeshCoreFeatures,
Expand Down

0 comments on commit c1fda33

Please sign in to comment.