feat(stt): recherche web (SearXNG in-cluster) + fix cluster_status (#49)

Phase 2 d'Asa agentique : nouvel outil web_search adossé à un SearXNG
self-host in-cluster, + correction du faux positif de cluster_status.

- SearXNG (k8s/apps/searxng/) : Deployment + Service + ConfigMap settings.yml
  + IngressRoute searxng.lab.local, Application ArgoCD. Namespace ai, interne
  (l'outil tape http://searxng:8080). use_default_settings + search.formats
  inclut json (sinon API JSON 403) ; limiter/image_proxy off ; image pinnée ;
  conf copiée dans un emptyDir via initContainer (contourne le mount RO) ;
  PodSecurity restricted.
- Outil web_search (tools._web_search) ajouté au contexte asa + STT_SEARXNG_URL.
- fix(cluster_status) : les pods de CronJob TERMINÉS (Succeeded/Failed, ex.
  sacrifice-assign-renfort) comptaient comme « non prêts » → fausse alarme.
  Join kube_pod_status_phase{phase=~"Running |Pending"} (3 faux positifs → 0,
  validé in-cluster).
- Serveur 0.8.0 ; doc stt.md + journal mis à jour.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ALI YESILKAYA 2026-06-22 22:10:59 +02:00 committed by GitHub
parent c9e89c91b9
commit 73b52cde2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 270 additions and 16 deletions

View file

@ -0,0 +1,24 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: searxng
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: git@github.com:Alkatrazz24/Funk-lab.git
targetRevision: main
path: k8s/apps/searxng
directory:
recurse: true
destination:
server: https://kubernetes.default.svc
namespace: ai
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true

View file

@ -0,0 +1,29 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: searxng-settings
namespace: ai
data:
# SearXNG hérite de ses défauts (tous les moteurs) via use_default_settings, puis on
# surcharge le strict nécessaire. CRITIQUE : `search.formats` doit inclure `json` — sinon
# l'API JSON (utilisée par l'outil web_search d'Asa) renvoie 403. Instance INTERNE au
# cluster (pas d'Ingress WAN) : limiter/botdetection off, image_proxy off.
settings.yml: |
use_default_settings: true
general:
instance_name: "Funk SearXNG"
debug: false
server:
# secret_key d'une instance INTERNE (HMAC image-proxy, ici désactivé) — sensibilité
# faible. Déplaçable vers un Secret + SEARXNG_SECRET plus tard si besoin.
secret_key: "3c7090f1caa8fb060ad99e432fd9523aa8dacbfb134438ff02afbddf6cf350ad"
limiter: false
image_proxy: false
search:
formats:
- html
- json
safe_search: 0
autocomplete: ""
ui:
static_use_hash: true

View file

@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: searxng
namespace: ai
spec:
replicas: 1
selector:
matchLabels:
app: searxng
template:
metadata:
labels:
app: searxng
annotations:
# Redéploie le pod quand settings.yml change (le hash bouge → nouveau rollout).
checksum/config: "searxng-settings-v1"
spec:
# Conformité PodSecurity "restricted" (namespace ai). L'image tourne en uid 977 (searxng).
# fsGroup 977 → l'emptyDir /etc/searxng est accessible en écriture par l'init + le main.
securityContext:
runAsNonRoot: true
runAsUser: 977
runAsGroup: 977
fsGroup: 977
seccompProfile:
type: RuntimeDefault
# Copie settings.yml (ConfigMap RO) dans un emptyDir inscriptible → évite les soucis
# de mount RO de l'entrypoint searxng (chown/sed éventuels sur le fichier de conf).
initContainers:
- name: copy-config
image: docker.io/searxng/searxng:2026.6.22-952896d29
command: ["sh", "-c", "cp /config-src/settings.yml /etc/searxng/settings.yml"]
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
volumeMounts:
- name: config-src
mountPath: /config-src
readOnly: true
- name: config
mountPath: /etc/searxng
containers:
- name: searxng
image: docker.io/searxng/searxng:2026.6.22-952896d29
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
ports:
- containerPort: 8080
env:
# Base URL interne (pas d'exposition WAN). Requis par SearXNG pour générer ses liens.
- name: SEARXNG_BASE_URL
value: "http://searxng.lab.local/"
volumeMounts:
- name: config
mountPath: /etc/searxng
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
resources:
requests:
cpu: 100m
memory: 192Mi
limits:
cpu: "1"
memory: 512Mi
volumes:
- name: config-src
configMap:
name: searxng-settings
- name: config
emptyDir: {}

View file

@ -0,0 +1,16 @@
# Exposition LAN facultative (debug / usage manuel du méta-moteur). L'outil web_search
# d'Asa, lui, tape le Service in-cluster directement (http://searxng:8080).
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: searxng
namespace: ai
spec:
entryPoints:
- web
routes:
- match: Host(`searxng.lab.local`)
kind: Rule
services:
- name: searxng
port: 8080

View file

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: searxng
namespace: ai
spec:
selector:
app: searxng
ports:
- port: 8080
targetPort: 8080

View file

@ -56,6 +56,9 @@ spec:
# live du homelab et la doc d'elle-même. « funk » (RAG strict) reste sélectionnable.
- name: STT_DEFAULT_CONTEXT
value: "asa"
# Recherche web (outil web_search du contexte asa) → SearXNG in-cluster (ns ai).
- name: STT_SEARXNG_URL
value: "http://searxng:8080"
- name: STT_PROMETHEUS_URL
value: "http://kube-prometheus-stack-prometheus.monitoring:9090"
- name: STT_ALERTMANAGER_URL