Skip to content

Instantly share code, notes, and snippets.

@nguyenthang98
Created May 19, 2021 14:28
Show Gist options
  • Save nguyenthang98/50213852d6886753e27767ba47d76e64 to your computer and use it in GitHub Desktop.
Save nguyenthang98/50213852d6886753e27767ba47d76e64 to your computer and use it in GitHub Desktop.
envoy-testing
job "envoy" {
datacenters = ["dc1"]
type = "service"
group "envoy" {
constraint {
attribute = "${node.unique.name}"
value = "node-1"
}
count = 1
task envoy {
driver = "docker"
config {
image = "envoyproxy/envoy-alpine:v1.16.3"
network_mode = "host"
args = ["-c", "/opt/envoy.yaml"]
cap_add = ["NET_ADMIN", "NET_RAW"]
privileged = true
volumes = [
"local/envoy.yaml:/opt/envoy.yaml",
]
}
env {
ENVOY_UID = 0
}
template {
data = <<EOF
static_resources:
listeners:
- name: listener_0
reuse_port: true
address:
socket_address:
protocol: UDP
address: 0.0.0.0
port_value: 4040
listener_filters:
- name: envoy.filters.udp_listener.udp_proxy
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.udp.udp_proxy.v3.UdpProxyConfig
stat_prefix: service
use_original_src_ip: true
cluster: service_be
- name: listener_1
reuse_port: true
address:
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 4040
filter_chains:
- filters:
name: envoy.filters.network.tcp_proxy
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
stat_prefix: service_be
cluster: service_be
clusters:
- name: service_be
connect_timeout: 0.25s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
transport_socket:
name: envoy.transport_sockets.upstream_proxy_protocol
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.proxy_protocol.v3.ProxyProtocolUpstreamTransport
config:
version: V1
transport_socket:
name: envoy.transport_sockets.raw_buffer
load_assignment:
cluster_name: service_be
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 172.28.162.79
port_value: 8080
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 10001
EOF
destination = "local/envoy.yaml"
}
}
}
}
job "envoy1" {
datacenters = ["dc1"]
type = "service"
group "envoy1" {
constraint {
attribute = "${node.unique.name}"
value = "node-3"
}
count = 1
task envoy {
driver = "docker"
config {
image = "envoyproxy/envoy-alpine:v1.16.3"
network_mode = "host"
args = ["--base-id", "1", "-c", "/opt/envoy.yaml"]
cap_add = ["NET_ADMIN", "NET_RAW"]
privileged = true
volumes = [
"local/envoy.yaml:/opt/envoy.yaml",
]
}
env {
ENVOY_UID = 0
}
template {
data = <<EOF
static_resources:
listeners:
- name: listener_0
reuse_port: true
address:
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 4041
listener_filters:
- name: envoy.filters.listener.proxy_protocol
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.listener.proxy_protocol.v3.ProxyProtocol
- name: envoy.filters.listener.original_src
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.listener.original_src.v3.OriginalSrc
mark: 123
filter_chains:
- filters:
name: envoy.filters.network.tcp_proxy
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
stat_prefix: service_be
cluster: service_be
clusters:
- name: service_be
connect_timeout: 0.25s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: service_be
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 172.28.174.58
port_value: 4040
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 10002
EOF
destination = "local/envoy.yaml"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment