# AWOOOI API - 開發環境 Deployment
# 版本: v1.0 | 日期: 2026-04-01

apiVersion: apps/v1
kind: Deployment
metadata:
  name: awoooi-api
  namespace: awoooi-dev
  labels:
    app: awoooi-api
    system: awoooi
    environment: dev
spec:
  replicas: 1
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app: awoooi-api
      environment: dev
  template:
    metadata:
      labels:
        app: awoooi-api
        system: awoooi
        environment: dev
    spec:
      serviceAccountName: awoooi-executor-dev
      automountServiceAccountToken: true
      containers:
        - name: api
          image: 192.168.0.110:5000/awoooi/api:dev-latest
          imagePullPolicy: Always
          ports:
            - containerPort: 8000
              name: http
          envFrom:
            - configMapRef:
                name: awoooi-config
            - secretRef:
                name: awoooi-secrets
          env:
            - name: PROMETHEUS_MULTIPROC_DIR
              value: "/tmp/awoooi-prometheus-multiproc"
          volumeMounts:
            - name: prometheus-multiproc
              mountPath: /tmp/awoooi-prometheus-multiproc
          resources:
            requests:
              cpu: "100m"
              memory: "256Mi"
            limits:
              cpu: "500m"
              memory: "512Mi"
          livenessProbe:
            httpGet:
              path: /api/v1/health
              port: 8000
            initialDelaySeconds: 30
            periodSeconds: 15
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /api/v1/health
              port: 8000
            initialDelaySeconds: 10
            periodSeconds: 10
            failureThreshold: 3
      volumes:
        - name: prometheus-multiproc
          emptyDir: {}

---
apiVersion: v1
kind: Service
metadata:
  name: awoooi-api-svc
  namespace: awoooi-dev
  labels:
    app: awoooi-api
    environment: dev
spec:
  type: NodePort
  selector:
    app: awoooi-api
    environment: dev
  ports:
    - port: 8000
      targetPort: 8000
      nodePort: 32344
      name: http
