apiVersion: apps/v1
kind: Deployment
metadata:
  name: ops-worker
  namespace: ai-agents
  labels:
    app.kubernetes.io/name: ops-worker
    agentic-os.io/agent: ops-agent
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: ops-worker
  template:
    metadata:
      labels:
        app.kubernetes.io/name: ops-worker
        agentic-os.io/agent: ops-agent
    spec:
      serviceAccountName: default
      initContainers:
        - name: git-clone
          image: alpine/git
          command:
            - "sh"
            - "-c"
            - "git clone http://192.168.8.248:3000/deepkoluguri/agentic-os.git /workspace && cp -r /workspace/agents/ops_agent/* /app/"
          volumeMounts:
            - name: app-code
              mountPath: /app
      containers:
        - name: ops-worker
          image: python:3.11-slim
          imagePullPolicy: Always
          command: ["sh", "-c", "pip install -r /app/requirements.txt && cd /app && python -m ops_agent.temporal.worker"]
          volumeMounts:
            - name: app-code
              mountPath: /app
          env:
            - name: TEMPORAL_ADDRESS
              value: "temporal-frontend.ai-core.svc.cluster.local:7233"
            - name: TEMPORAL_NAMESPACE
              value: "default"
            - name: PYTHONUNBUFFERED
              value: "1"
            - name: OPS_TASK_QUEUE
              value: "ops"
            - name: MOCK_OPS
              value: "false" # Set to false to run actual checks in the cluster
            - name: LOCAL_WHATSAPP_URL
              value: "http://whatsapp-gateway.ai-agents.svc.cluster.local:5001/send-message"
            - 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
          resources:
            requests:
              cpu: 500m
              memory: 512Mi
            limits:
              cpu: "2"
              memory: 2Gi
      volumes:
        - name: app-code
          emptyDir: {}
