129 lines
3.9 KiB
YAML
129 lines
3.9 KiB
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: envoy-gateway-config
|
|
namespace: mpr
|
|
data:
|
|
envoy.yaml: |
|
|
static_resources:
|
|
listeners:
|
|
- name: http
|
|
address:
|
|
socket_address:
|
|
address: 0.0.0.0
|
|
port_value: 8080
|
|
filter_chains:
|
|
- filters:
|
|
- name: envoy.filters.network.http_connection_manager
|
|
typed_config:
|
|
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
|
|
stat_prefix: ingress
|
|
codec_type: AUTO
|
|
route_config:
|
|
name: local_routes
|
|
virtual_hosts:
|
|
- name: mpr
|
|
domains: ["k8s.mpr.local.ar", "*"]
|
|
routes:
|
|
# SSE — long timeout, no buffering
|
|
- match:
|
|
prefix: "/api/detect/stream/"
|
|
route:
|
|
cluster: fastapi
|
|
timeout: 3600s
|
|
idle_timeout: 3600s
|
|
# FastAPI — strip /api/ prefix
|
|
- match:
|
|
prefix: "/api/"
|
|
route:
|
|
cluster: fastapi
|
|
prefix_rewrite: "/"
|
|
# Detection UI
|
|
- match:
|
|
prefix: "/detection/"
|
|
route:
|
|
cluster: detection-ui
|
|
# Default
|
|
- match:
|
|
prefix: "/"
|
|
route:
|
|
cluster: detection-ui
|
|
prefix_rewrite: "/detection/"
|
|
http_filters:
|
|
- name: envoy.filters.http.router
|
|
typed_config:
|
|
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
|
|
clusters:
|
|
- name: fastapi
|
|
connect_timeout: 5s
|
|
type: STRICT_DNS
|
|
lb_policy: ROUND_ROBIN
|
|
load_assignment:
|
|
cluster_name: fastapi
|
|
endpoints:
|
|
- lb_endpoints:
|
|
- endpoint:
|
|
address:
|
|
socket_address:
|
|
address: fastapi
|
|
port_value: 8702
|
|
- name: detection-ui
|
|
connect_timeout: 5s
|
|
type: STRICT_DNS
|
|
lb_policy: ROUND_ROBIN
|
|
load_assignment:
|
|
cluster_name: detection-ui
|
|
endpoints:
|
|
- lb_endpoints:
|
|
- endpoint:
|
|
address:
|
|
socket_address:
|
|
address: detection-ui
|
|
port_value: 5175
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: gateway
|
|
namespace: mpr
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: gateway
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: gateway
|
|
spec:
|
|
containers:
|
|
- name: envoy
|
|
image: envoyproxy/envoy:v1.28-latest
|
|
ports:
|
|
- containerPort: 8080
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /etc/envoy
|
|
resources:
|
|
requests:
|
|
memory: 64Mi
|
|
cpu: 50m
|
|
limits:
|
|
memory: 256Mi
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: envoy-gateway-config
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: gateway
|
|
namespace: mpr
|
|
spec:
|
|
selector:
|
|
app: gateway
|
|
ports:
|
|
- port: 80
|
|
targetPort: 8080
|