This commit is contained in:
2026-03-23 14:42:36 -03:00
parent 71fd0510de
commit 5ed876d694
17 changed files with 767 additions and 137 deletions

78
ctrl/k8s/base/envoy.yaml Normal file
View File

@@ -0,0 +1,78 @@
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: ["mpr.local.ar", "k8s.mpr.local.ar", "*"]
routes:
# SSE — long timeout, no buffering, strip /api prefix
- match:
prefix: "/api/detect/stream/"
route:
cluster: fastapi
prefix_rewrite: "/detect/stream/"
timeout: 3600s
idle_timeout: 3600s
# FastAPI — strip /api/ prefix
- match:
prefix: "/api/"
route:
cluster: fastapi
prefix_rewrite: "/"
# Detection UI (with WebSocket upgrade for Vite HMR)
- match:
prefix: "/detection/"
route:
cluster: detection-ui
upgrade_configs:
- upgrade_type: websocket
# 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