Skip to content

Commit

Permalink
set always_consume_default_token_bucket false
Browse files Browse the repository at this point in the history
Signed-off-by: huabing zhao <[email protected]>
  • Loading branch information
zhaohuabing committed Dec 12, 2023
1 parent f11d519 commit c564c8d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/xds/translator/local_ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
hcmv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
typev3 "github.com/envoyproxy/go-control-plane/envoy/type/v3"
"github.com/golang/protobuf/ptypes/duration"
"github.com/golang/protobuf/ptypes/wrappers"
"google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/wrapperspb"

Expand Down Expand Up @@ -168,6 +169,13 @@ func (*localRateLimit) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) e
},
},
Descriptors: descriptors,
// By setting AlwaysConsumeDefaultTokenBucket to false, the descriptors
// won't consume the default token bucket. This means that a request only
// counts towards the default token bucket if it does not match any of the
// descriptors.
AlwaysConsumeDefaultTokenBucket: &wrappers.BoolValue{
Value: false,
},
}

localRlAny, err := anypb.New(localRl)
Expand Down

0 comments on commit c564c8d

Please sign in to comment.