Skip to content

Commit f52d46c

Browse files
committed
feat: add a gRPC-web envoy
1 parent e65c27a commit f52d46c

File tree

2 files changed

+140
-0
lines changed

2 files changed

+140
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
apiVersion: v1
2+
data:
3+
envoy.yaml: |-
4+
admin:
5+
access_log_path: /tmp/admin_access.log
6+
address:
7+
socket_address:
8+
address: 0.0.0.0
9+
port_value: 9000
10+
static_resources:
11+
listeners:
12+
- name: listener_0
13+
address:
14+
socket_address:
15+
address: 0.0.0.0
16+
port_value: 8080
17+
filter_chains:
18+
- filters:
19+
- name: envoy.filters.network.http_connection_manager
20+
typed_config:
21+
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
22+
stat_prefix: ingress_http
23+
access_log:
24+
- name: envoy.access_loggers.stdout
25+
typed_config:
26+
"@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog
27+
http_filters:
28+
- name: envoy.filters.http.grpc_web
29+
- name: envoy.filters.http.cors
30+
- name: envoy.filters.http.router
31+
route_config:
32+
name: local_route
33+
virtual_hosts:
34+
- name: local_service
35+
domains: [ "*" ]
36+
routes:
37+
- match:
38+
prefix: "/"
39+
route:
40+
cluster: grpc_service
41+
timeout: 0s
42+
max_stream_duration:
43+
grpc_timeout_header_max: 0s
44+
cors:
45+
allow_origin_string_match:
46+
- prefix: "*"
47+
allow_methods: GET, PUT, DELETE, POST, OPTIONS
48+
allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout
49+
max_age: "1728000"
50+
expose_headers: custom-header-1,grpc-status,grpc-message
51+
clusters:
52+
- name: grpc_service
53+
connect_timeout: 0.25s
54+
type: logical_dns
55+
lb_policy: round_robin
56+
load_assignment:
57+
cluster_name: cluster_0
58+
endpoints:
59+
- lb_endpoints:
60+
- endpoint:
61+
address:
62+
socket_address:
63+
address: server
64+
port_value: 9000
65+
kind: ConfigMap
66+
metadata:
67+
name: envoy-config
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
kind: Ingress
2+
apiVersion: networking.k8s.io/v1
3+
metadata:
4+
name: envoy
5+
annotations:
6+
dev.okteto.com/generate-host: "true"
7+
kubernetes.io/ingress.class: "nginx"
8+
nginx.ingress.kubernetes.io/ssl-redirect: "true"
9+
spec:
10+
rules:
11+
- host: this-name-does-not-matter
12+
http:
13+
paths:
14+
- path: /
15+
pathType: Prefix
16+
backend:
17+
service:
18+
name: envoy
19+
port:
20+
name: envoy
21+
---
22+
apiVersion: v1
23+
kind: Service
24+
metadata:
25+
labels:
26+
app: envoy
27+
name: envoy
28+
spec:
29+
ports:
30+
- name: envoy
31+
port: 8080
32+
protocol: TCP
33+
targetPort: envoy
34+
- name: admin
35+
port: 9000
36+
protocol: TCP
37+
targetPort: admin
38+
selector:
39+
app: envoy
40+
type: ClusterIP
41+
---
42+
apiVersion: apps/v1
43+
kind: Deployment
44+
metadata:
45+
labels:
46+
app: envoy
47+
name: envoy
48+
spec:
49+
replicas: 1
50+
selector:
51+
matchLabels:
52+
app: envoy
53+
template:
54+
metadata:
55+
labels:
56+
app: envoy
57+
spec:
58+
containers:
59+
- image: envoyproxy/envoy-alpine:v1.18-latest
60+
name: envoy-distroless
61+
ports:
62+
- containerPort: 9000
63+
name: admin
64+
- containerPort: 8080
65+
name: envoy
66+
volumeMounts:
67+
- mountPath: /etc/envoy/envoy.yaml
68+
subPath: envoy.yaml
69+
name: envoy-config
70+
volumes:
71+
- name: envoy-config
72+
configMap:
73+
name: envoy-config

0 commit comments

Comments
 (0)