New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support BackendRef HTTP filters #3246
Conversation
274ac15
to
1188ea7
Compare
53163a5
to
15f536d
Compare
8618b87
to
632b748
Compare
this may conflict with #3212, should decide which go first. |
2285eb6
to
458ced2
Compare
/retest |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3246 +/- ##
=======================================
Coverage 67.32% 67.33%
=======================================
Files 166 166
Lines 19211 19275 +64
=======================================
+ Hits 12934 12979 +45
- Misses 5347 5358 +11
- Partials 930 938 +8 ☔ View full report in Codecov by Sentry. |
5ea22af
to
11bf097
Compare
/retest |
@zirain rebased the PR, as your changes went first 😄 |
hey @cnvergence small nits, overall LGTM, thanks for adding this feature !
|
fd89de9
to
60d0954
Compare
/retest |
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
60d0954
to
2781416
Compare
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
2781416
to
43e69a4
Compare
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks great! Just a few non-blocking nits, which can be addressed in a follow-up PR.
@@ -1225,17 +1225,71 @@ func (t *Translator) processDestination(backendRefContext BackendRefContext, | |||
gwapiv1a2.RouteReasonResolvedRefs, | |||
"Mixed endpointslice address type for the same backendRef is not supported") | |||
} | |||
|
|||
destinationFilters := t.processDestinationFilters(routeType, backendRefContext, parentRef, route, resources) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove route
parameter here? Passing an unused parameter into this function could be confusing.
destinationFilters := t.processDestinationFilters(routeType, backendRefContext, parentRef, route, resources) | |
destinationFilters := t.processDestinationFilters(routeType, backendRefContext, parentRef, resources) |
|
||
switch filters := backendFilters.(type) { | ||
case []gwapiv1.HTTPRouteFilter: | ||
httpFiltersContext = t.ProcessHTTPFilters(parentRef, route, filters, 0, resources) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably not an ideal solution, but it makes it clear that route is not needed in this case.
httpFiltersContext = t.ProcessHTTPFilters(parentRef, route, filters, 0, resources) | |
httpFiltersContext = t.ProcessHTTPFilters(parentRef, nil, filters, 0, resources) |
httpFiltersContext = t.ProcessHTTPFilters(parentRef, route, filters, 0, resources) | ||
|
||
case []gwapiv1.GRPCRouteFilter: | ||
httpFiltersContext = t.ProcessGRPCFilters(parentRef, route, filters, resources) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
httpFiltersContext = t.ProcessGRPCFilters(parentRef, route, filters, resources) | |
httpFiltersContext = t.ProcessGRPCFilters(parentRef, nil, filters, resources) |
@@ -222,41 +222,70 @@ func buildXdsStringMatcher(irMatch *ir.StringMatch) *matcherv3.StringMatcher { | |||
return stringMatcher | |||
} | |||
|
|||
func buildXdsRouteAction(backendWeights *ir.BackendWeights) *routev3.RouteAction { | |||
func buildXdsRouteAction(backendWeights *ir.BackendWeights, settings []*ir.DestinationSetting) *routev3.RouteAction { | |||
// only use weighted cluster when there are invalid weights |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this comment should be updated. Adding a few lines to explain the reason would help people who come later.
What type of PR is this?
What this PR does / why we need it:
Currently, only support for RequestHeaderModifiier and ResponseHeaderModifier type, as it is the only filter with
straightforward support in
https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#config-route-v3-weightedcluster-clusterweight
Which issue(s) this PR fixes:
Fixes #2572 #3338