Hello,
I’m facing an issue while using local rate limiting with below config. Rate limiting would ignore quotas specified for each header (foo, boo) and only respect the quota specified for the default token bucket which is 10req per 20s. Maybe I’m missing something here, but the documentation didn’t help me to solve this.
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: filter-local-ratelimit-svc
namespace: mynamespace
spec:
workloadSelector:
labels:
app: nginx-test
configPatches:
- applyTo: HTTP_FILTER
listener:
filterChain:
filter:
name: "envoy.http_connection_manager"
patch:
operation: INSERT_BEFORE
value:
name: envoy.filters.http.local_ratelimit
typed_config:
"@type": type.googleapis.com/udpa.type.v1.TypedStruct
type_url: type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit
value:
stat_prefix: http_local_rate_limiter
- applyTo: HTTP_ROUTE
match:
context: SIDECAR_INBOUND
routeConfiguration:
vhost:
name: ""
patch:
operation: MERGE
value:
route:
rate_limits:
- actions:
- request_headers:
header_name: "service"
descriptor_key: "x-service"
typed_per_filter_config:
envoy.filters.http.local_ratelimit:
"@type": type.googleapis.com/udpa.type.v1.TypedStruct
type_url: type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit
value:
stat_prefix: http_local_rate_limiter
descriptors:
- entries:
- key: x-service
value: boo
token_bucket:
max_tokens: 2
tokens_per_fill: 2
fill_interval: 20s
- entries:
- key: x-service
value: foo
token_bucket:
max_tokens: 5
tokens_per_fill: 5
fill_interval: 20s
filter_enabled:
runtime_key: local_rate_limit_enabled
default_value:
numerator: 100
denominator: HUNDRED
filter_enforced:
runtime_key: local_rate_limit_enforced
default_value:
numerator: 100
denominator: HUNDRED
response_headers_to_add:
- append: false
header:
key: x-local-rate-limit
value: 'true'
token_bucket:
max_tokens: 10
tokens_per_fill: 10
fill_interval: 20s