Skip to content

Commit

Permalink
xds: Ensure v2 route match is populated for gRPC
Browse files Browse the repository at this point in the history
Similar to HTTP, ensure that route match config (which is required by
Envoy) is populated when default values are used.

Because the default matches generated for gRPC contain a single empty
`GRPCRouteMatch`, and that proto does not directly support prefix-based
config, an interpretation of the empty struct is needed to generate the
same output that the `HTTPRouteMatch` is explicitly configured to
provide in internal/mesh/internal/controllers/routes/generate.go.
  • Loading branch information
zalimeni authored and jmurret committed Oct 25, 2023
1 parent e414cbe commit 0a8fe0d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,12 @@ func makeGRPCRouteMatch(match *pbmesh.GRPCRouteMatch) *pbproxystate.RouteMatch {
default:
panic(fmt.Sprintf("unknown method match type: %v", match.Method.Type))
}
} else {
em.PathMatch = &pbproxystate.PathMatch{
PathMatch: &pbproxystate.PathMatch_Prefix{
Prefix: "/",
},
}
}

em.HeaderMatches = translateHeaderMatches(match.Headers, nil)
Expand Down

0 comments on commit 0a8fe0d

Please sign in to comment.