Funk-lab/k8s/apps/stt/deployment.yaml
ALI YESILKAYA 1faf50a9be
feat(stt-server): contextes présélectionnables + sources live + contexte assemblé (visualiseur) (#38)
Asa n'est plus bloqué sur le seul contexte « doc cluster grounding-strict ». Le client
choisit un contexte par requête ; le serveur change le system prompt ET injecte les
données live du domaine, puis renvoie le contexte assemblé pour le visualiseur du HUD.

- contexts.py : profils funk / ghostfolio / grafana / alerting / cluster (system prompt
  + sources) + assemble() (prompt final + structure de visualisation).
- sources.py : fetchers live best-effort (Ghostfolio auth+details, Alertmanager alerts
  hors Watchdog, Prometheus cluster/metrics), env-config, dégradation propre.
- brain.py : ask() reçoit le system prompt déjà assemblé (assemblage remonté).
- app.py : /v1/ask accepte `context`, renvoie context_id + le contexte assemblé ;
  nouveau GET /v1/contexts ; RAG doc conditionné au profil.
- config.py : URLs sources + STT_GHOSTFOLIO_TOKEN + STT_DEFAULT_CONTEXT.
- deployment : env in-cluster (Prometheus/Alertmanager monitoring, Ghostfolio ai),
  jeton via secret optionnel stt-server-secrets/ghostfolio-token.
- bump 0.3.1 → 0.4.0.

Validé en local : assemblage (blocs+RAG+mémoire), parsing des sources (mock),
endpoints /v1/contexts et /v1/ask (LLM mocké) — context_id, visualiseur, fallback
contexte inconnu → funk.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 23:49:29 +02:00

90 lines
3.2 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: stt-server
namespace: ai
spec:
replicas: 1
selector:
matchLabels:
app: stt-server
template:
metadata:
labels:
app: stt-server
spec:
# Image privée sur ghcr → secret de pull créé manuellement dans le ns ai
# (cf. README : kubectl create secret docker-registry ghcr-pull ...)
imagePullSecrets:
- name: ghcr-pull
# Conformité PodSecurity "restricted" (namespace ai)
securityContext:
runAsNonRoot: true
runAsUser: 1000
seccompProfile:
type: RuntimeDefault
containers:
- name: stt-server
# Tag géré par la CI (build-stt-server.yml) : bumpé en sha-<commit> à chaque build main.
image: ghcr.io/alkatrazz24/funk-stt-server:sha-d982308
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
ports:
- containerPort: 8000
env:
# LiteLLM (s01) joint en IP directe — même pattern qu'open-webui
- name: STT_LITELLM_URL
value: "http://192.168.10.1:4000/v1/chat/completions"
- name: STT_LITELLM_KEY
value: "lm-studio"
- name: STT_MODEL
value: "hermes-default"
# Mémoire long-terme (Qdrant s01 + embeddings nomic gpu-01) — dégrade si injoignable
- name: STT_MEMORY_LONGTERM
value: "true"
- name: STT_QDRANT_URL
value: "http://192.168.10.1:6333"
# Instance dédiée embeddings nomic-embed-text sur gpu-01 (:1238, dim 768)
- name: STT_EMBED_URL
value: "http://192.168.10.20:1238/v1/embeddings"
- name: STT_EMBED_MODEL
value: "nomic-embed-text"
# Contextes présélectionnables (sources live) — services in-cluster
- name: STT_DEFAULT_CONTEXT
value: "funk"
- name: STT_PROMETHEUS_URL
value: "http://kube-prometheus-stack-prometheus.monitoring:9090"
- name: STT_ALERTMANAGER_URL
value: "http://kube-prometheus-stack-alertmanager.monitoring:9093"
- name: STT_GHOSTFOLIO_URL
value: "http://ghostfolio:3333" # même namespace (ai)
# Jeton Ghostfolio (« Security token ») — secret optionnel créé à la main :
# kubectl -n ai create secret generic stt-server-secrets \
# --from-literal=ghostfolio-token=<TOKEN>
- name: STT_GHOSTFOLIO_TOKEN
valueFrom:
secretKeyRef:
name: stt-server-secrets
key: ghostfolio-token
optional: true
readinessProbe:
httpGet:
path: /healthz
port: 8000
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /healthz
port: 8000
initialDelaySeconds: 10
periodSeconds: 20
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi