---
# AutoJanet Intake Service
# Accepts task submissions via HTTP and creates Vikunja tasks with agent labels.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: intake
  namespace: autojanet
  labels:
    autojanet/role: intake
spec:
  replicas: 1
  selector:
    matchLabels:
      autojanet/role: intake
  template:
    metadata:
      labels:
        autojanet/role: intake
    spec:
      serviceAccountName: intake
      containers:
        - name: intake
          image: registry.ctz.fyi/library/autojanet-intake:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
          env:
            - name: VIKUNJA_BASE_URL
              value: "http://vikunja.vikunja.svc.cluster.local:3456"
            - name: VIKUNJA_PROJECT_ID
              value: "78"
            - name: VIKUNJA_TODO_BUCKET_ID
              value: "116"
            - name: VIKUNJA_VIEW_ID
              value: "114"
            - name: VIKUNJA_PM_TOKEN
              valueFrom:
                secretKeyRef:
                  name: intake-vikunja-token
                  key: token
          resources:
            requests:
              cpu: "50m"
              memory: "64Mi"
            limits:
              cpu: "200m"
              memory: "128Mi"
          livenessProbe:
            httpGet:
              path: /health
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 15
          securityContext:
            allowPrivilegeEscalation: false
            runAsNonRoot: true
            runAsUser: 1000
            readOnlyRootFilesystem: true
            capabilities:
              drop: ["ALL"]
---
apiVersion: v1
kind: Service
metadata:
  name: intake
  namespace: autojanet
spec:
  selector:
    autojanet/role: intake
  ports:
    - port: 80
      targetPort: 8080
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: intake
  namespace: autojanet
