Skip to content

Commit 650c3f7

Browse files
committed
Run two envoys
1 parent a902af9 commit 650c3f7

File tree

5 files changed

+123
-3
lines changed

5 files changed

+123
-3
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ WORKDIR /home/gradle/src
7575
RUN gradle :envoy-control-runner:assemble --parallel --no-daemon
7676

7777
FROM envoyproxy/envoy-alpine-dev:6c2137468c25d167dbbe4719b0ecaf343bfb4233 as envoy
78-
COPY heroku/envoy.yaml /etc/envoy.yaml
78+
COPY heroku/envoy1.yaml /etc/envoy1.yaml
79+
COPY heroku/envoy2.yaml /etc/envoy2.yaml
7980
COPY heroku/envoy-front-proxy.yaml /etc/envoy-front-proxy.yaml
8081
COPY --from=consul /bin/consul /bin/consul
8182

@@ -84,6 +85,7 @@ RUN mkdir /tmp/envoy-control-dist /tmp/envoy-control /bin/envoy-control /etc/env
8485
COPY --from=build /home/gradle/src/envoy-control-runner/build/distributions/ /tmp/envoy-control-dist
8586
COPY ./envoy-control-runner/src/main/resources/application.yaml /etc/envoy-control/
8687
COPY heroku/register-echo1.json /etc/envoy-control/
88+
COPY heroku/register-echo2.json /etc/envoy-control/
8789
RUN tar -xf /tmp/envoy-control-dist/envoy-control-runner*.tar -C /tmp/envoy-control
8890
RUN mv /tmp/envoy-control/envoy-control-runner*/ /bin/envoy-control/envoy-control-runner
8991
# APP_PORT: 8080

heroku/envoy.yaml renamed to heroku/envoy1.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ node:
2727
add_upstream_external_address_header: true
2828
resources_dir: "/etc/envoy/extra"
2929
proxy_settings:
30+
incoming:
31+
endpoints:
32+
- pathPrefix: "/"
33+
clients: ["echo2"]
3034
outgoing:
3135
dependencies:
3236
- service: "consul"
3337
- service: "echo1"
38+
- service: "echo2"
3439
static_resources:
3540
listeners:
3641
- name: ingress_direct_response
@@ -60,7 +65,7 @@ static_resources:
6065
direct_response:
6166
status: 200
6267
body:
63-
inline_string: "Hello"
68+
inline_string: "Hello from echo1"
6469
http_filters:
6570
- name: envoy.filters.http.router
6671
clusters:

heroku/envoy2.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
admin:
2+
access_log_path: /dev/stdout
3+
address:
4+
socket_address:
5+
address: 0.0.0.0
6+
port_value: 10022
7+
dynamic_resources:
8+
lds_config: {ads: {}}
9+
cds_config: {ads: {}}
10+
ads_config:
11+
api_type: GRPC
12+
grpc_services:
13+
envoy_grpc:
14+
cluster_name: envoy-control-xds
15+
node:
16+
cluster: test-cluster
17+
id: test-id
18+
metadata:
19+
service_name: "echo2"
20+
ads: true
21+
ingress_host: "0.0.0.0"
22+
ingress_port: 10020
23+
egress_host: "0.0.0.0"
24+
egress_port: 10021
25+
use_remote_address: true
26+
access_log_enabled: false
27+
add_upstream_external_address_header: true
28+
resources_dir: "/etc/envoy/extra"
29+
proxy_settings:
30+
incoming:
31+
endpoints:
32+
- pathPrefix: "/"
33+
clients: ["echo1"]
34+
outgoing:
35+
dependencies:
36+
- service: "consul"
37+
- service: "echo1"
38+
- service: "echo2"
39+
static_resources:
40+
listeners:
41+
- name: ingress_direct_response
42+
address:
43+
socket_address:
44+
address: 0.0.0.0
45+
port_value: 10023
46+
filter_chains:
47+
- filters:
48+
- name: envoy.filters.network.http_connection_manager
49+
typed_config:
50+
"@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
51+
use_remote_address: true
52+
stat_prefix: ingress_http
53+
codec_type: AUTO
54+
route_config:
55+
name: local_route
56+
virtual_hosts:
57+
- name: local_service
58+
domains: ["*"]
59+
routes:
60+
- match: { prefix: "/status/envoy/"}
61+
route:
62+
cluster: this_admin
63+
prefix_rewrite: "/"
64+
- match: { path: "/" }
65+
direct_response:
66+
status: 200
67+
body:
68+
inline_string: "Hello from echo2"
69+
http_filters:
70+
- name: envoy.filters.http.router
71+
clusters:
72+
- name: local_service
73+
connect_timeout: 1s
74+
hosts:
75+
- socket_address:
76+
address: 127.0.0.1
77+
port_value: 10023
78+
http2_protocol_options: {}
79+
- name: envoy-control-xds
80+
connect_timeout: 1s
81+
hosts:
82+
- socket_address:
83+
address: 127.0.0.1
84+
port_value: 50000
85+
http2_protocol_options: {}
86+
- name: this_admin
87+
type: STATIC
88+
connect_timeout: 1s
89+
load_assignment:
90+
cluster_name: this_admin
91+
endpoints:
92+
- lb_endpoints:
93+
- endpoint:
94+
address:
95+
socket_address:
96+
address: 127.0.0.1
97+
port_value: 10022

heroku/register-echo2.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ID":"echo2",
3+
"Name":"echo2",
4+
"Tags":[
5+
"primary"
6+
],
7+
"Address":"127.0.0.1",
8+
"Port":10020,
9+
"Check":{
10+
"DeregisterCriticalServiceAfter":"90m",
11+
"http":"http://127.0.0.1:10020",
12+
"Interval":"10s"
13+
}
14+
}
15+

heroku/run-envoy.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ echo "Launching Envoy-control with $START_ARGUMENTS"
1515

1616
# start envoys
1717
sed -i "s/{{.IngressListenerPort}}/${PORT:-10000}/g" /etc/envoy-front-proxy.yaml
18-
sh -c 'sleep 20; /usr/local/bin/envoy --base-id 1 -c /etc/envoy.yaml' &
18+
sh -c 'sleep 20; /usr/local/bin/envoy --base-id 1 -c /etc/envoy1.yaml' &
19+
sh -c 'sleep 20; /usr/local/bin/envoy --base-id 2 -c /etc/envoy2.yaml' &
1920
/usr/local/bin/envoy -c /etc/envoy-front-proxy.yaml &
2021

2122
sh -c 'sleep 25; curl -X PUT -s localhost:8500/v1/agent/service/register -T /etc/envoy-control/register-echo1.json' &

0 commit comments

Comments
 (0)