Skip to content

Commit 1db1988

Browse files
committed
v2 api support
1 parent 5e0d80e commit 1db1988

File tree

5 files changed

+57
-30
lines changed

5 files changed

+57
-30
lines changed

circuit-breaker/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Circuit Breaker
22

3-
[Circuit Breaking](https://www.envoyproxy.io/learn/circuit-breaking) lets you configure failure thresholds that ensure safe maximums after which these requests stop. This allows for a more graceful failure, and time to respond to potential issues before they become larger.
3+
[Circuit Breaking](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/circuit_breaking) lets you configure failure thresholds that ensure safe maximums after which these requests stop. This allows for a more graceful failure, and time to respond to potential issues before they become larger.
44

55
## Demo Overview
66

@@ -27,7 +27,7 @@ Key definition - `clusters` in [service-envoy-circuitbreaker.yaml](service-envo
2727
address: 127.0.0.1
2828
port_value: 8080
2929
```
30-
> For the detail of `circuit_breakers` configuration, see [cluster.CircuitBreakers](https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/cluster/circuit_breaker.proto#envoy-api-msg-cluster-circuitbreakers)
30+
> For the detail of `circuit_breakers` configuration, see [configuration example](https://www.envoyproxy.io/docs/envoy/latest/configuration/upstream/cluster_manager/cluster_circuit_breakers#config-cluster-manager-cluster-circuit-breakers) and API reference, [cluster.CircuitBreakers](https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/cluster/circuit_breaker.proto#envoy-api-msg-cluster-circuitbreakers)
3131

3232
## Getting Started
3333
```sh
@@ -122,4 +122,4 @@ $ docker-compose down --remove-orphans --rmi all
122122
```
123123

124124
---
125-
[Top](../README.md)
125+
[Top](../README.md)

circuit-breaker/docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '2'
1+
version: '3.7'
22
services:
33

44
front-envoy:
@@ -11,11 +11,11 @@ services:
1111
- envoymesh
1212
expose:
1313
# Expose ports 80 (for general traffic) and 8001 (for the admin server)
14-
- "80"
14+
- "8000"
1515
- "8001"
1616
ports:
17-
# Map the host port 8000 to container port 80, and the host port 8001 to container port 8001
18-
- "8000:80"
17+
# Map the host port 8000 to container port 8000, and the host port 8001 to container port 8001
18+
- "8000:8000"
1919
- "8001:8001"
2020

2121
service_green:

circuit-breaker/front-envoy.yaml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ static_resources:
33
- address:
44
socket_address:
55
address: 0.0.0.0
6-
port_value: 80
6+
port_value: 8000
77
filter_chains:
88
- filters:
9-
- name: envoy.http_connection_manager
10-
config:
9+
- name: envoy.filters.network.http_connection_manager
10+
typed_config:
11+
"@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
1112
codec_type: auto
1213
stat_prefix: ingress_http
1314
route_config:
@@ -26,30 +27,49 @@ static_resources:
2627
route:
2728
cluster: service_red
2829
http_filters:
29-
- name: envoy.router
30-
config: {}
30+
- name: envoy.filters.http.router
31+
typed_config: {}
3132
clusters:
3233
- name: service_green
3334
connect_timeout: 0.25s
3435
type: strict_dns
3536
lb_policy: round_robin
3637
http2_protocol_options: {}
37-
hosts:
38-
- socket_address:
39-
address: service_green
40-
port_value: 80
38+
load_assignment:
39+
cluster_name: service_green
40+
endpoints:
41+
- lb_endpoints:
42+
- endpoint:
43+
address:
44+
socket_address:
45+
address: service_green
46+
port_value: 80
4147
- name: service_red
4248
connect_timeout: 0.25s
4349
type: strict_dns
4450
lb_policy: round_robin
4551
http2_protocol_options: {}
46-
hosts:
47-
- socket_address:
48-
address: service_red
49-
port_value: 80
52+
load_assignment:
53+
cluster_name: service_red
54+
endpoints:
55+
- lb_endpoints:
56+
- endpoint:
57+
address:
58+
socket_address:
59+
address: service_red
60+
port_value: 80
5061
admin:
5162
access_log_path: "/dev/null"
5263
address:
5364
socket_address:
5465
address: 0.0.0.0
5566
port_value: 8001
67+
layered_runtime:
68+
layers:
69+
- name: static_layer_0
70+
static_layer:
71+
envoy:
72+
resource_limits:
73+
listener:
74+
example_listener_name:
75+
connection_limit: 10000

circuit-breaker/service-envoy-circuitbreaker.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ static_resources:
66
port_value: 80
77
filter_chains:
88
- filters:
9-
- name: envoy.http_connection_manager
10-
config:
9+
- name: envoy.filters.network.http_connection_manager
10+
typed_config:
11+
"@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
1112
codec_type: auto
1213
stat_prefix: ingress_http
1314
route_config:

circuit-breaker/service-envoy.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ static_resources:
66
port_value: 80
77
filter_chains:
88
- filters:
9-
- name: envoy.http_connection_manager
10-
config:
9+
- name: envoy.filters.network.http_connection_manager
10+
typed_config:
11+
"@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
1112
codec_type: auto
1213
stat_prefix: ingress_http
1314
route_config:
@@ -22,17 +23,22 @@ static_resources:
2223
route:
2324
cluster: local_service
2425
http_filters:
25-
- name: envoy.router
26-
config: {}
26+
- name: envoy.filters.http.router
27+
typed_config: {}
2728
clusters:
2829
- name: local_service
2930
connect_timeout: 0.25s
3031
type: strict_dns
3132
lb_policy: round_robin
32-
hosts:
33-
- socket_address:
34-
address: 127.0.0.1
35-
port_value: 8080
33+
load_assignment:
34+
cluster_name: local_service
35+
endpoints:
36+
- lb_endpoints:
37+
- endpoint:
38+
address:
39+
socket_address:
40+
address: 127.0.0.1
41+
port_value: 8080
3642
admin:
3743
access_log_path: "/dev/null"
3844
address:

0 commit comments

Comments
 (0)