apiVersion: apps/v1
kind: Deployment
metadata:
  name: vapora-agents
  namespace: vapora
  labels:
    app: vapora-agents
    component: agents
spec:
  replicas: 3
  selector:
    matchLabels:
      app: vapora-agents
  template:
    metadata:
      labels:
        app: vapora-agents
        component: agents
    spec:
      containers:
      - name: agents
        image: vapora/agents:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 9000
          name: http
          protocol: TCP
        env:
        - name: RUST_LOG
          value: "info,vapora_agents=debug"
        - name: NATS_URL
          value: "nats://nats:4222"
        - name: BIND_ADDR
          value: "0.0.0.0:9000"
        - name: ANTHROPIC_API_KEY
          valueFrom:
            secretKeyRef:
              name: vapora-secrets
              key: anthropic-api-key
        - name: OPENAI_API_KEY
          valueFrom:
            secretKeyRef:
              name: vapora-secrets
              key: openai-api-key
        - name: GEMINI_API_KEY
          valueFrom:
            secretKeyRef:
              name: vapora-secrets
              key: gemini-api-key
              optional: true
        livenessProbe:
          httpGet:
            path: /health
            port: 9000
          initialDelaySeconds: 10
          periodSeconds: 10
          timeoutSeconds: 5
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /ready
            port: 9000
          initialDelaySeconds: 5
          periodSeconds: 5
          timeoutSeconds: 3
          failureThreshold: 3
        resources:
          requests:
            cpu: 200m
            memory: 256Mi
          limits:
            cpu: 500m
            memory: 512Mi

---
apiVersion: v1
kind: Service
metadata:
  name: vapora-agents
  namespace: vapora
  labels:
    app: vapora-agents
    component: agents
spec:
  selector:
    app: vapora-agents
  ports:
  - port: 9000
    targetPort: 9000
    name: http
    protocol: TCP
  type: ClusterIP
