From c0deb5b0efb0978d7c49f395b5ddcd9116109019 Mon Sep 17 00:00:00 2001 From: ccaraman Date: Wed, 11 Jan 2017 12:49:52 -0800 Subject: [PATCH] Update templates with new ratelimit configuration (#344) --- .../envoy_service_to_service.template.json | 15 +++++++--- configs/routing_helper.template.json | 5 ---- test/config/integration/server.json | 30 ++++++++++--------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/configs/envoy_service_to_service.template.json b/configs/envoy_service_to_service.template.json index 0240c0c7966a..fcbc4ae0f993 100644 --- a/configs/envoy_service_to_service.template.json +++ b/configs/envoy_service_to_service.template.json @@ -130,6 +130,16 @@ { "prefix": "/", {{ helper.make_route_internal(service, options) }} + {% if options.get('service_to_service_rate_limit', False) %} + , + "rate_limits":[ + { + "actions": [ + {"type": "service_to_service"} + ] + } + ] + {% endif %} } ] }{% if not loop.last %},{% endif -%} @@ -139,10 +149,7 @@ "filters": [ {"type": "decoder", "name": "rate_limit", "config": { - "domain": "envoy_service_to_service", - "actions": [ - {"type": "service_to_service"} - ] + "domain": "envoy_service_to_service" } }, {"type": "both", "name": "grpc_http1_bridge", "config": {}}, diff --git a/configs/routing_helper.template.json b/configs/routing_helper.template.json index 5952073aad3f..41da0b48a6a2 100644 --- a/configs/routing_helper.template.json +++ b/configs/routing_helper.template.json @@ -5,11 +5,6 @@ "retry_policy": { "retry_on": "{{ options.get('retry_on', 'connect-failure') }}" }, - {% if 'global_rate_limit' in options %} - "rate_limit": { - "global": true - }, - {% endif %} "cluster": "{{ cluster }}" {% endmacro %} diff --git a/test/config/integration/server.json b/test/config/integration/server.json index fa65c1a60ef1..531684730de1 100644 --- a/test/config/integration/server.json +++ b/test/config/integration/server.json @@ -63,9 +63,13 @@ { "prefix": "/test/long/url", "cluster": "cluster_1", - "rate_limit": { - "global": true - } + "rate_limits": [ + { + "actions": [ + {"type": "service_to_service"} + ] + } + ] }, { "prefix": "/test/", @@ -83,10 +87,7 @@ }, { "type": "decoder", "name": "rate_limit", "config": { - "domain": "foo", - "actions": [ - {"type": "service_to_service"} - ] + "domain": "foo" } }, { "type": "decoder", "name": "router", "config": {} } @@ -144,9 +145,13 @@ { "prefix": "/test/long/url", "cluster": "cluster_1", - "rate_limit": { - "global": true - } + "rate_limits": [ + { + "actions": [ + {"type": "service_to_service"} + ] + } + ] }, { "prefix": "/test/", @@ -164,10 +169,7 @@ }, { "type": "decoder", "name": "rate_limit", "config": { - "domain": "foo", - "actions": [ - {"type": "service_to_service"} - ] + "domain": "foo" } }, { "type": "decoder", "name": "buffer",