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

View File

@@ -19,21 +19,19 @@ docker_build(
],
)
# Detection UI (Vue 3)
# Detection UI (Vue 3) — context is ui/ so framework link resolves
docker_build(
'mpr-detection',
context='../ui/detection-app',
context='../ui',
dockerfile='../ui/detection-app/Dockerfile',
live_update=[
sync('../ui/detection-app/src', '/app/src'),
sync('../ui/detection-app/index.html', '/app/index.html'),
sync('../ui/detection-app/vite.config.ts', '/app/vite.config.ts'),
sync('../ui/detection-app/src', '/ui/detection-app/src'),
sync('../ui/detection-app/index.html', '/ui/detection-app/index.html'),
sync('../ui/detection-app/vite.config.ts', '/ui/detection-app/vite.config.ts'),
sync('../ui/framework/src', '/ui/framework/src'),
],
)
# Framework changes trigger a full rebuild (live_update can't reach outside context)
watch_file('../ui/framework/src')
# --- Resources ---
k8s_resource('redis')

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

View File

@@ -1,86 +1,3 @@
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:

View File

@@ -10,3 +10,10 @@ resources:
- fastapi.yaml
- detection-ui.yaml
- gateway.yaml
configMapGenerator:
- name: envoy-gateway-config
files:
- envoy.yaml
options:
disableNameSuffixHash: true