-
Notifications
You must be signed in to change notification settings - Fork 360
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
tcproute/udproute support multiple backends #3212
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3212 +/- ##
==========================================
- Coverage 67.11% 66.87% -0.25%
==========================================
Files 164 163 -1
Lines 23818 23307 -511
==========================================
- Hits 15986 15587 -399
+ Misses 6912 6814 -98
+ Partials 920 906 -14 ☔ View full report in Codecov by Sentry. |
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
b80c66f
to
bf79459
Compare
Signed-off-by: zirain <zirain2009@gmail.com>
internal/xds/translator/route.go
Outdated
backendWeights := httpRoute.Destination.ToWeightedBackend() | ||
routeAction := buildXdsRouteAction(backendWeights) | ||
routeAction.IdleTimeout = idleTimeout(httpRoute) |
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.
cc @arkodg , this's the key point, use BackendWeights to generate ClusterSpecifier everywhere.
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.
thanks for adding this note :). the diff is massive, stared with this file and the IR and this approach makes sense
b0c5c1e
to
16c6627
Compare
- backendWeights: | ||
invalid: 1 | ||
valid: 0 | ||
directResponse: |
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.
why is directResponse
getting removed
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.
fixed, see 115fdb1
settings: | ||
- weight: 1 | ||
name: tcproute/default/tcproute-1 | ||
tls: {} |
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.
curious why we have an empty tls
struct here
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.
see 9084108
Signed-off-by: zirain <zirain2009@gmail.com>
@@ -516,7 +516,8 @@ func (t *Translator) processGRPCRouteRules(grpcRoute *GRPCRouteContext, parentRe | |||
|
|||
// If the route has no valid backends then just use a direct response and don't fuss with weighted responses | |||
for _, ruleRoute := range ruleRoutes { | |||
if ruleRoute.Destination == nil && ruleRoute.Redirect == nil { | |||
noValidBackends := ruleRoute.Destination == nil || ruleRoute.Destination.ToBackendWeights().Valid == 0 |
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.
shouldnt this be invalidBackendsExist
instead of noValidBackends
i.e. some instead of all ?
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.
noValidBackends = invalidBackendsExist | emptyBackends
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.
but noValidBackends
also implies validBackends == 0 which is not true here
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.
in current code validBackends == 0 equals emptyBackends
Signed-off-by: zirain <zirain2009@gmail.com>
@@ -1158,12 +1136,12 @@ func (t *Translator) processDestination(backendRefContext BackendRefContext, | |||
|
|||
backendNamespace := NamespaceDerefOr(backendRef.Namespace, route.GetNamespace()) | |||
if !t.validateBackendRef(backendRefContext, parentRef, route, resources, backendNamespace, routeType) { | |||
return nil, weight | |||
return &ir.DestinationSetting{Weight: &weight} |
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.
can we add a comment here highlighting that this is referring to an invalid weight
} | ||
} | ||
|
||
// If the route has no valid backends then just use a direct response and don't fuss with weighted responses | ||
for _, ruleRoute := range ruleRoutes { | ||
if ruleRoute.Destination == nil && ruleRoute.Redirect == nil { | ||
noValidBackends := ruleRoute.Destination == nil || ruleRoute.Destination.ToBackendWeights().Valid == 0 | ||
if noValidBackends && ruleRoute.Redirect == nil { |
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.
isnt something like this needed in processHTTPRouteRules
as well ?
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.
good catch
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 !
/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
fix: #3174