Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
Signed-off-by: zirain <zirain2009@gmail.com>
  • Loading branch information
zirain committed May 13, 2024
1 parent e6d5676 commit 16c6627
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/ir/xds.go
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ func (r *RouteDestination) Validate() error {
return errs
}

func (r *RouteDestination) ToWeightedBackend() *BackendWeights {
func (r *RouteDestination) ToBackendWeights() *BackendWeights {
w := &BackendWeights{
Name: r.Name,
}
Expand Down
3 changes: 2 additions & 1 deletion internal/xds/translator/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func buildXdsRoute(httpRoute *ir.HTTPRoute) (*routev3.Route, error) {

router.Action = &routev3.Route_Route{Route: routeAction}
default:
backendWeights := httpRoute.Destination.ToWeightedBackend()
backendWeights := httpRoute.Destination.ToBackendWeights()
routeAction := buildXdsRouteAction(backendWeights)
routeAction.IdleTimeout = idleTimeout(httpRoute)

Expand Down Expand Up @@ -219,6 +219,7 @@ func buildXdsStringMatcher(irMatch *ir.StringMatch) *matcherv3.StringMatcher {
}

func buildXdsRouteAction(backendWeights *ir.BackendWeights) *routev3.RouteAction {
// only use weighted cluster when there are invalid weights
if backendWeights.Invalid == 0 {
return &routev3.RouteAction{
ClusterSpecifier: &routev3.RouteAction_Cluster{
Expand Down

0 comments on commit 16c6627

Please sign in to comment.