apiVersion: v1
kind: Service
metadata:
  name: decision-center-dev
  namespace: unidesk-dev
  labels:
    app.kubernetes.io/name: decision-center
    app.kubernetes.io/part-of: unidesk
    app.kubernetes.io/component: decision-center
    unidesk.ai/environment: dev
    unidesk.ai/deployment-mode: k3sctl-managed
spec:
  type: ClusterIP
  selector:
    app.kubernetes.io/name: decision-center
    app.kubernetes.io/part-of: unidesk
    app.kubernetes.io/component: decision-center
    unidesk.ai/environment: dev
  ports:
    - name: http
      port: 4277
      targetPort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: decision-center-dev
  namespace: unidesk-dev
  labels:
    app.kubernetes.io/name: decision-center
    app.kubernetes.io/part-of: unidesk
    app.kubernetes.io/component: decision-center
    unidesk.ai/environment: dev
    unidesk.ai/deployment-mode: k3sctl-managed
  annotations:
    unidesk.ai/deploy-ref: deploy.json#environments.dev.services.decision-center
    unidesk.ai/deploy-service-id: decision-center
    unidesk.ai/image-source: deploy-env-commit
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/name: decision-center
      app.kubernetes.io/part-of: unidesk
      app.kubernetes.io/component: decision-center
      unidesk.ai/environment: dev
  template:
    metadata:
      labels:
        app.kubernetes.io/name: decision-center
        app.kubernetes.io/part-of: unidesk
        app.kubernetes.io/component: decision-center
        unidesk.ai/environment: dev
        unidesk.ai/node-id: D601
        unidesk.ai/deploy-service-id: decision-center
    spec:
      nodeSelector:
        unidesk.ai/node-id: D601
      terminationGracePeriodSeconds: 15
      containers:
        - name: decision-center
          image: unidesk-decision-center:dev-placeholder
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 4277
          env:
            - name: HOST
              value: "0.0.0.0"
            - name: PORT
              value: "4277"
            - name: DATABASE_URL
              valueFrom:
                secretKeyRef:
                  name: unidesk-dev-runtime-secrets
                  key: DATABASE_URL
            - name: DATABASE_POOL_MAX
              value: "2"
            - name: UNIDESK_DATABASE_NAME
              value: unidesk_dev
            - name: UNIDESK_DEPLOY_SERVICE_ID
              value: decision-center
            - name: UNIDESK_DEPLOY_REPO
              value: https://github.com/pikasTech/unidesk
            - name: UNIDESK_DEPLOY_COMMIT
              value: replace-with-deploy-env-commit
            - name: UNIDESK_DEPLOY_REQUESTED_COMMIT
              value: replace-with-deploy-env-commit
            - name: LOG_FILE
              value: /var/log/unidesk-dev/decision-center-dev.jsonl
          volumeMounts:
            - name: logs
              mountPath: /var/log/unidesk-dev
          readinessProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 18
          livenessProbe:
            httpGet:
              path: /live
              port: http
            periodSeconds: 10
            timeoutSeconds: 3
            failureThreshold: 6
          startupProbe:
            httpGet:
              path: /live
              port: http
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 30
          resources:
            requests:
              cpu: 50m
              memory: 96Mi
            limits:
              memory: 512Mi
      volumes:
        - name: logs
          hostPath:
            path: /home/ubuntu/cq-deploy/.state/decision-center-dev/logs
            type: DirectoryOrCreate
