apiVersion: v1
kind: Service
metadata:
  name: claudeqq-dev
  namespace: unidesk-dev
  labels:
    app.kubernetes.io/name: claudeqq
    app.kubernetes.io/part-of: unidesk
    app.kubernetes.io/component: claudeqq
    unidesk.ai/environment: dev
    unidesk.ai/deployment-mode: k3sctl-managed
    unidesk.ai/deploy-service-id: claudeqq
spec:
  type: ClusterIP
  selector:
    app.kubernetes.io/name: claudeqq
    app.kubernetes.io/part-of: unidesk
    app.kubernetes.io/component: claudeqq
    unidesk.ai/environment: dev
  ports:
    - name: http
      port: 3290
      targetPort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: claudeqq-dev
  namespace: unidesk-dev
  labels:
    app.kubernetes.io/name: claudeqq
    app.kubernetes.io/part-of: unidesk
    app.kubernetes.io/component: claudeqq
    unidesk.ai/environment: dev
    unidesk.ai/deployment-mode: k3sctl-managed
    unidesk.ai/deploy-service-id: claudeqq
  annotations:
    unidesk.ai/deploy-ref: deploy.json#environments.dev.services.claudeqq
    unidesk.ai/deploy-service-id: claudeqq
    unidesk.ai/image-source: deploy-env-commit
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/name: claudeqq
      app.kubernetes.io/part-of: unidesk
      app.kubernetes.io/component: claudeqq
      unidesk.ai/environment: dev
  template:
    metadata:
      labels:
        app.kubernetes.io/name: claudeqq
        app.kubernetes.io/part-of: unidesk
        app.kubernetes.io/component: claudeqq
        unidesk.ai/environment: dev
        unidesk.ai/node-id: D601
        unidesk.ai/deploy-service-id: claudeqq
    spec:
      nodeSelector:
        unidesk.ai/node-id: D601
      terminationGracePeriodSeconds: 30
      containers:
        - name: napcat
          image: mlikiowa/napcat-docker:latest
          imagePullPolicy: IfNotPresent
          ports:
            - name: napcat-http
              containerPort: 3000
            - name: napcat-ws
              containerPort: 3001
            - name: napcat-webui
              containerPort: 6099
          env:
            - name: WEBUI_PREFIX
              value: "/webui"
            - name: WEBUI_TOKEN
              value: "unidesk-napcat-dev"
            - name: NAPCAT_UID
              value: "1000"
            - name: NAPCAT_GID
              value: "1000"
            - name: ACCOUNT
              value: "763382329"
          volumeMounts:
            - name: napcat-qq
              mountPath: /app/.config/QQ
            - name: napcat-config
              mountPath: /app/napcat/config
            - name: napcat-cache
              mountPath: /app/napcat/cache
          readinessProbe:
            tcpSocket:
              port: napcat-http
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 12
          livenessProbe:
            tcpSocket:
              port: napcat-http
            periodSeconds: 10
            timeoutSeconds: 3
            failureThreshold: 12
        - name: claudeqq
          image: unidesk-claudeqq:dev-placeholder
          imagePullPolicy: IfNotPresent
          workingDir: /app/scripts/src/server_ts
          command:
            - node
            - unidesk-adapter.cjs
          ports:
            - name: http
              containerPort: 3290
          env:
            - name: CLAUDEQQ_HOST
              value: "0.0.0.0"
            - name: CLAUDEQQ_PORT
              value: "3290"
            - name: CLAUDEQQ_ADAPTER_PORT
              value: "3290"
            - name: CLAUDEQQ_UPSTREAM_HOST
              value: "127.0.0.1"
            - name: CLAUDEQQ_UPSTREAM_PORT
              value: "9082"
            - name: CLAUDEQQ_WORKSPACE_DIR
              value: "/bot_workspace"
            - name: CLAUDEQQ_AUTO_REPLY
              value: "false"
            - name: CLAUDEQQ_NAPCAT_HTTP_HOST
              value: "127.0.0.1"
            - name: CLAUDEQQ_NAPCAT_HTTP_PORT
              value: "3000"
            - name: CLAUDEQQ_NAPCAT_WS_HOST
              value: "127.0.0.1"
            - name: CLAUDEQQ_NAPCAT_WS_PORT
              value: "3001"
            - name: CLAUDEQQ_NAPCAT_ACCOUNT
              value: "763382329"
            - name: CLAUDEQQ_NAPCAT_DATA_DIR
              value: "/napcat"
            - name: CLAUDEQQ_NAPCAT_WEBUI_URL
              value: "http://127.0.0.1:6099/webui"
            - name: CLAUDEQQ_ONLINE_NOTICE_ENABLED
              value: "false"
            - name: CLAUDEQQ_LOGIN_MONITOR_INTERVAL_MS
              value: "10000"
            - name: UNIDESK_DEPLOY_SERVICE_ID
              value: claudeqq
            - name: UNIDESK_DEPLOY_REPO
              value: https://gitee.com/lyon1998/agent_skills
            - name: UNIDESK_DEPLOY_COMMIT
              value: replace-with-deploy-env-commit
            - name: UNIDESK_DEPLOY_REQUESTED_COMMIT
              value: replace-with-deploy-env-commit
          volumeMounts:
            - name: config-json
              mountPath: /app/config.json
              readOnly: true
            - name: bot-workspace
              mountPath: /bot_workspace
            - name: logs
              mountPath: /app/logs
            - name: state
              mountPath: /app/.state
            - name: napcat-root
              mountPath: /napcat
              readOnly: true
            - name: napcat-shell
              mountPath: /app/NapCat.Shell.Windows.OneKey
              readOnly: true
          readinessProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 20
          livenessProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 10
            timeoutSeconds: 3
            failureThreshold: 12
          startupProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 60
          resources:
            requests:
              cpu: 100m
              memory: 256Mi
            limits:
              memory: 1Gi
      volumes:
        - name: config-json
          hostPath:
            path: /home/ubuntu/.agents/skills/claudeqq/config.json
            type: File
        - name: bot-workspace
          hostPath:
            path: /home/ubuntu/.agents/skills/claudeqq-dev/bot_workspace
            type: DirectoryOrCreate
        - name: logs
          hostPath:
            path: /home/ubuntu/.agents/skills/claudeqq-dev/logs
            type: DirectoryOrCreate
        - name: state
          hostPath:
            path: /home/ubuntu/.agents/skills/claudeqq-dev/.state
            type: DirectoryOrCreate
        - name: napcat-root
          hostPath:
            path: /home/ubuntu/.agents/skills/claudeqq-dev/napcat
            type: DirectoryOrCreate
        - name: napcat-qq
          hostPath:
            path: /home/ubuntu/.agents/skills/claudeqq-dev/napcat/qq
            type: DirectoryOrCreate
        - name: napcat-config
          hostPath:
            path: /home/ubuntu/.agents/skills/claudeqq-dev/napcat/config
            type: DirectoryOrCreate
        - name: napcat-cache
          hostPath:
            path: /home/ubuntu/.agents/skills/claudeqq-dev/napcat/cache
            type: DirectoryOrCreate
        - name: napcat-shell
          hostPath:
            path: /home/ubuntu/.agents/skills/claudeqq/NapCat.Shell.Windows.OneKey
            type: DirectoryOrCreate
