Skip to content

Commit

Permalink
Update local_rate_limit.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
smarunich authored Sep 23, 2024
1 parent 51894fa commit e90e300
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions samples/local_rate_limit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,69 @@ spec:
labels:
app: edge-gw
EOF

#
kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: edge-ratelimit
namespace: edge
spec:
workloadSelector:
labels:
app: edge-gw
configPatches:
- applyTo: HTTP_FILTER
match:
context: GATEWAY
listener:
filterChain:
filter:
name: "envoy.filters.network.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: GATEWAY
routeConfiguration:
vhost:
name: "apibin.tfc.dogfood.sandbox.tetrate.io:8080"
route:
action: ANY
patch:
operation: MERGE
value:
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
token_bucket:
max_tokens: 4
tokens_per_fill: 4
fill_interval: 60s
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'
EOF

0 comments on commit e90e300

Please sign in to comment.