2026-08-17 13:40:09 +03:00

111 lines
2.9 KiB
YAML

# LawSynth gateway (services/gateway): the request-admission boundary in front
# of the API. Enforces body/header limits, per-client rate limiting, and CORS
# before traffic reaches application handlers (architecture sections 7, 22).
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gateway
labels:
app.kubernetes.io/name: gateway
app.kubernetes.io/component: edge
spec:
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: gateway
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app.kubernetes.io/name: gateway
app.kubernetes.io/component: edge
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8081"
prometheus.io/path: "/v1/metrics"
spec:
serviceAccountName: lawsynth-gateway
securityContext:
runAsNonRoot: true
runAsUser: 65532
runAsGroup: 65532
seccompProfile:
type: RuntimeDefault
containers:
- name: gateway
image: ghcr.io/lawsynth/gateway:latest
command:
- gunicorn
- --bind=0.0.0.0:8081
- --workers=2
- --timeout=120
- --access-logfile=-
- --error-logfile=-
- lawsynth_gateway.wsgi:application
ports:
- name: http
containerPort: 8081
env:
# Admit requests only for the in-cluster API upstream.
- name: LAWSYNTH_GATEWAY_UPSTREAM_URL
valueFrom:
configMapKeyRef:
name: lawsynth-config
key: LAWSYNTH_GATEWAY_UPSTREAM_URL
envFrom:
- configMapRef:
name: lawsynth-config
readinessProbe:
httpGet:
path: /v1/health
port: http
initialDelaySeconds: 5
periodSeconds: 10
failureThreshold: 3
livenessProbe:
httpGet:
path: /v1/health
port: http
initialDelaySeconds: 15
periodSeconds: 20
failureThreshold: 3
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
volumeMounts:
- name: tmp
mountPath: /tmp
volumes:
- name: tmp
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: gateway
labels:
app.kubernetes.io/name: gateway
app.kubernetes.io/component: edge
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: gateway
ports:
- name: http
port: 8081
targetPort: http