# Template for a Gumbo Kubernetes Job.
# Secrets are managed by ExternalSecrets (see gumbo-externalsecrets.yaml).
# Replace REPLACE_IMAGE with the registry image after CI builds agents/gumbo.
apiVersion: batch/v1
kind: Job
metadata:
  name: gumbo-run
  namespace: ai-agents-gumbo
  annotations:
    argocd.argoproj.io/sync-options: Replace=true,Prune=false
  labels:
    app.kubernetes.io/name: gumbo
    app.kubernetes.io/component: job
    agentic-os.io/agent: gumbo
spec:
  suspend: true
  ttlSecondsAfterFinished: 86400
  backoffLimit: 0
  template:
    metadata:
      labels:
        app.kubernetes.io/name: gumbo-job
        agentic-os.io/agent: gumbo
    spec:
      restartPolicy: Never
      securityContext:
        runAsNonRoot: true
        runAsUser: 1000
        fsGroup: 1000
      containers:
        - name: gumbo
          image: REPLACE_IMAGE
          imagePullPolicy: IfNotPresent
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop: ["ALL"]
          env:
            - name: GUMBO_OBJECT_KEY
              value: "REPLACE_OBJECT_KEY"
            - name: GUMBO_THREAD_ID
              valueFrom:
                fieldRef:
                  fieldPath: metadata.uid
            - name: MCP_FS_SSE_URL
              value: "http://mcp-filesystem.tools-mcp.svc.cluster.local:8080/sse"
            - name: LITELLM_BASE_URL
              value: "http://ollama.ai-core.svc.cluster.local:11434/v1"
            - name: GUMBO_LLM_MODEL
              value: "qwen2.5:3b"
            - name: LITELLM_API_KEY
              valueFrom:
                secretKeyRef:
                  name: gumbo-litellm
                  key: api_key
            - name: LANGGRAPH_CHECKPOINT_URI
              valueFrom:
                secretKeyRef:
                  name: gumbo-checkpoint-db
                  key: uri
            - name: GUMBO_RESULTS_DSN
              valueFrom:
                secretKeyRef:
                  name: gumbo-results-db
                  key: dsn
          resources:
            requests:
              cpu: "1"
              memory: 2Gi
            limits:
              cpu: "4"
              memory: 8Gi
