-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
envoy_front_proxy.template.yaml
194 lines (194 loc) · 7.11 KB
/
envoy_front_proxy.template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
{% import 'routing_helper.template.yaml' as helper -%}
{% macro router_file_content() -%}{% include kwargs['router_file'] -%}{% endmacro -%}
{% macro listener(protocol, address, port_value, proxy_proto, tls, tracing) -%}
name: not_required_for_static_listeners
address:
socket_address:
protocol: {{protocol}}
address: {{address}}
port_value: {{port_value}}
{% if proxy_proto %}
listener_filters:
- name: envoy.filters.listener.proxy_protocol
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.listener.proxy_protocol.v3.ProxyProtocol
{% endif %}
filter_chains:
{% if tls %}
- transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
common_tls_context:
alpn_protocols: h2,http/1.1
tls_certificates:
- certificate_chain:
filename: certs/servercert.pem
private_key:
filename: certs/serverkey.pem
{% if kwargs.get('pin_double_proxy_client', False) %}
validation_context:
trusted_ca:
filename: certs/cacert.pm
#This should be the hash of the /etc/envoy/envoy-double-proxy.pem cert used in the
#double proxy configuration.
verify_certificate_hash: "0000000000000000000000000000000000000000000000000000000000000000"
{% endif %}
{%endif %}
filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: AUTO
stat_prefix: router
{% if proxy_proto -%}
use_remote_address: true
{%endif-%}
stat_prefix: ingress_http
route_config:
{{ router_file_content(router_file='envoy_router.template.yaml')|indent(10) }}
http_filters:
- name: envoy.filters.http.health_check
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck
pass_through_mode: false
headers:
- name: ":path"
string_match:
exact: "/healthcheck"
- name: envoy.filters.http.buffer
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.buffer.v3.Buffer
max_request_bytes: 5242880
- name: envoy.filters.http.ratelimit
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit
domain: envoy_front
request_type: external
rate_limit_service:
transport_api_version: V3
grpc_service:
envoy_grpc:
cluster_name: ratelimit
- name: envoy.filters.http.router
add_user_agent: true
{% if tracing %}
tracing:
provider:
name: envoy.tracers.lightstep
typed_config:
"@type": type.googleapis.com/envoy.config.trace.v3.LightstepConfig
collector_cluster: lightstep_saas
access_token:
filename: "/etc/envoy/lightstep_access_token"
{% endif %}
common_http_protocol_options:
idle_timeout: 840s
access_log:
- name: envoy.access_loggers.file
filter:
or_filter:
filters:
- status_code_filter:
comparison:
op: GE
value:
default_value: 500
runtime_key: access_log.access_error.status
- duration_filter:
comparison:
op: GE
value:
default_value: 1000
runtime_key: access_log.access_error.duration
- traceable_filter: {}
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
path: "/var/log/envoy/access_error.log"
log_format:
text_format_source:
inline_string: "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%REQ(X-LYFT-USER-ID)%\" \"%RESP(GRPC-STATUS)%\"\n"
{% endmacro -%}
static_resources:
listeners:
# TCP listeners for public HTTP/HTTPS endpoints. Assumes a TCP LB in front such as ELB which
# supports proxy proto.
- {{ listener("TCP", "0.0.0.0", "9300", True, True, tracing)|indent(2) }}
- {{ listener("TCP", "0.0.0.0", "9301", True, True, tracing)|indent(2) }}
# TCP listener for backhaul traffic from the double proxy.
# See envoy_double_proxy.template.json
- {{ listener("TCP", "0.0.0.0", "9400", True, True, tracing, pin_double_proxy_client=True)|indent(2) }}
clusters:
- name: sds
type: STRICT_DNS
connect_timeout: 0.25s
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: sds
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: discovery.yourcompany.net
port_value: 80
protocol: TCP
- name: statsd
type: STATIC
connect_timeout: 0.25s
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: statsd
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 8125
protocol: TCP
- name: lightstep_saas
type: LOGICAL_DNS
connect_timeout: 1s
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: lightstep_saas
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: collector-grpc.lightstep.com
port_value: 443
protocol: TCP
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicit_http_config:
http2_protocol_options: {}
{% for service, options in clusters.items() -%}
- {{ helper.internal_cluster_definition(service, options)|indent(2) }}
{% endfor %}
cluster_manager:
outlier_detection:
event_log_path: /var/log/envoy/outlier_events.log
flags_path: /etc/envoy/flags
layered_runtime:
layers:
- name: root
disk_layer:
symlink_root: /srv/configset/envoydata/current
subdirectory: envoy
- name: override
disk_layer:
symlink_root: /srv/configset/envoydata/current
subdirectory: envoy_override
append_service_cluster: true
- name: admin
admin_layer: {}
admin:
address:
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 9901