vanna-clubpetro/k8s/lab/deployment.yaml
Dalton Alvarenga 8a6b954b32
All checks were successful
CD / build (pull_request) Successful in 4m47s
[lab] fix(k8s): fsGroup/non-root no overlay de lab p/ imagem uid 10001
A imagem passou a rodar non-root (uid/gid 10001), mas o overlay de lab não
tinha securityContext/fsGroup — os dirs do PVC (chroma_db, data_storage)
ficavam root:root e a escrita do ChromaDB/CSV falhava com Permission denied
(pod subia e /health respondia, mas query quebraria). Alinha o lab ao hml:
- pod securityContext runAsNonRoot + runAsUser/Group/fsGroup 10001
- container: allowPrivilegeEscalation:false, drop ALL
- HOME=/home/app e cache ONNX montado em /home/app/.cache/chroma

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-11 19:14:48 -03:00

80 lines
2.4 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: vanna-clubpetro-deployment
labels:
app: vanna-clubpetro
spec:
replicas: 1 # ChromaDB SQLite-based — múltiplas réplicas corrompem o vector store
strategy:
type: Recreate # com PVC ReadWriteOnce não dá pra ter 2 pods montando ao mesmo tempo
selector:
matchLabels:
app: vanna-clubpetro
template:
metadata:
labels:
app: vanna-clubpetro
spec:
# A imagem roda como non-root (uid/gid 10001). fsGroup dá posse dos
# volumes (PVC) ao grupo 10001 pra que o processo consiga escrever no
# store/cache — sem isso o ChromaDB/CSV falha com Permission denied.
securityContext:
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 10001
fsGroup: 10001
containers:
- name: vanna-clubpetro
image: us-central1-docker.pkg.dev/corepetro/clubpetro-lab/vanna-clubpetro:lab-latest
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
ports:
- name: http
containerPort: 8765
env:
- name: HOME
value: /home/app
- name: VANNA_CORS_ORIGINS
value: "https://lab.clubpetro.com,https://homologation.clubpetro.com"
envFrom:
- secretRef:
name: vanna-clubpetro-secret
resources:
requests:
cpu: "200m"
memory: "1Gi"
limits:
cpu: "1"
memory: "2Gi"
readinessProbe:
tcpSocket:
port: 8765
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
livenessProbe:
tcpSocket:
port: 8765
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
volumeMounts:
- name: data
mountPath: /app/chroma_db
subPath: chroma_db
- name: data
mountPath: /app/data_storage
subPath: data_storage
- name: data
mountPath: /home/app/.cache/chroma
subPath: chroma-onnx-cache
volumes:
- name: data
persistentVolumeClaim:
claimName: vanna-clubpetro-data