apiVersion: v1
kind: Service
metadata:
  name: backend-core-dev
  namespace: unidesk-dev
  labels:
    app.kubernetes.io/name: backend-core
    app.kubernetes.io/component: core
    app.kubernetes.io/part-of: unidesk
    unidesk.ai/environment: dev
spec:
  selector:
    app.kubernetes.io/name: backend-core
    app.kubernetes.io/component: core
    unidesk.ai/environment: dev
  ports:
    - name: http
      port: 8080
      targetPort: http
    - name: provider
      port: 8081
      targetPort: provider
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-core-dev
  namespace: unidesk-dev
  labels:
    app.kubernetes.io/name: backend-core
    app.kubernetes.io/component: core
    app.kubernetes.io/part-of: unidesk
    unidesk.ai/environment: dev
  annotations:
    unidesk.ai/deploy-ref: origin/master:deploy.json#environments.dev
    unidesk.ai/image-source: deploy-env-commit
    unidesk.ai/deploy-service-id: backend-core
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: backend-core
      app.kubernetes.io/component: core
      unidesk.ai/environment: dev
  template:
    metadata:
      labels:
        app.kubernetes.io/name: backend-core
        app.kubernetes.io/component: core
        app.kubernetes.io/part-of: unidesk
        unidesk.ai/environment: dev
        unidesk.ai/node-id: D601
    spec:
      nodeSelector:
        unidesk.ai/node-id: D601
      terminationGracePeriodSeconds: 20
      containers:
        - name: backend-core
          image: unidesk-backend-core:dev-placeholder
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8080
            - name: provider
              containerPort: 8081
          envFrom:
            - configMapRef:
                name: unidesk-dev-runtime-config
            - secretRef:
                name: unidesk-dev-runtime-secrets
          env:
            - name: PORT
              value: "8080"
            - name: PROVIDER_PORT
              value: "8081"
            - name: DATABASE_URL
              valueFrom:
                secretKeyRef:
                  name: unidesk-dev-runtime-secrets
                  key: DATABASE_URL
            - name: PROVIDER_TOKEN
              valueFrom:
                secretKeyRef:
                  name: unidesk-dev-runtime-secrets
                  key: PROVIDER_TOKEN
            - name: DATABASE_VOLUME_NAME
              valueFrom:
                configMapKeyRef:
                  name: unidesk-dev-runtime-config
                  key: DATABASE_VOLUME_NAME
            - name: DATABASE_VOLUME_SIZE
              valueFrom:
                configMapKeyRef:
                  name: unidesk-dev-runtime-config
                  key: DATABASE_VOLUME_SIZE
            - name: UNIDESK_DATABASE_NAME
              value: unidesk_dev
            - name: UNIDESK_DEPLOY_SERVICE_ID
              value: backend-core
            - 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/backend-core-dev.jsonl
          volumeMounts:
            - name: logs
              mountPath: /var/log/unidesk-dev
          readinessProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 20
          livenessProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 10
            timeoutSeconds: 3
            failureThreshold: 6
          startupProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 60
          resources:
            requests:
              cpu: 100m
              memory: 192Mi
            limits:
              memory: 768Mi
      volumes:
        - name: logs
          emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: frontend-dev
  namespace: unidesk-dev
  labels:
    app.kubernetes.io/name: frontend
    app.kubernetes.io/component: web
    app.kubernetes.io/part-of: unidesk
    unidesk.ai/environment: dev
spec:
  selector:
    app.kubernetes.io/name: frontend
    app.kubernetes.io/component: web
    unidesk.ai/environment: dev
  ports:
    - name: http
      port: 8080
      targetPort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend-dev
  namespace: unidesk-dev
  labels:
    app.kubernetes.io/name: frontend
    app.kubernetes.io/component: web
    app.kubernetes.io/part-of: unidesk
    unidesk.ai/environment: dev
  annotations:
    unidesk.ai/deploy-ref: origin/master:deploy.json#environments.dev
    unidesk.ai/image-source: deploy-env-commit
    unidesk.ai/deploy-service-id: frontend
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: frontend
      app.kubernetes.io/component: web
      unidesk.ai/environment: dev
  template:
    metadata:
      labels:
        app.kubernetes.io/name: frontend
        app.kubernetes.io/component: web
        app.kubernetes.io/part-of: unidesk
        unidesk.ai/environment: dev
        unidesk.ai/node-id: D601
    spec:
      nodeSelector:
        unidesk.ai/node-id: D601
      terminationGracePeriodSeconds: 20
      containers:
        - name: frontend
          image: unidesk-frontend:dev-placeholder
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8080
          envFrom:
            - configMapRef:
                name: unidesk-dev-runtime-config
            - secretRef:
                name: unidesk-dev-runtime-secrets
          env:
            - name: PORT
              value: "8080"
            - name: CORE_INTERNAL_URL
              value: http://backend-core-dev.unidesk-dev.svc.cluster.local:8080
            - name: FRONTEND_PUBLIC_URL
              value: http://frontend-dev.unidesk-dev.svc.cluster.local:8080
            - name: PROVIDER_INGRESS_PUBLIC_URL
              value: ws://backend-core-dev.unidesk-dev.svc.cluster.local:8081/ws/provider
            - name: AUTH_USERNAME
              valueFrom:
                secretKeyRef:
                  name: unidesk-dev-runtime-secrets
                  key: AUTH_USERNAME
            - name: AUTH_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: unidesk-dev-runtime-secrets
                  key: AUTH_PASSWORD
            - name: PROVIDER_TOKEN
              valueFrom:
                secretKeyRef:
                  name: unidesk-dev-runtime-secrets
                  key: PROVIDER_TOKEN
            - name: UNIDESK_SSH_CLIENT_TOKEN
              valueFrom:
                secretKeyRef:
                  name: unidesk-dev-runtime-secrets
                  key: UNIDESK_SSH_CLIENT_TOKEN
            - name: UNIDESK_SSH_CLIENT_ROUTE_ALLOWLIST
              valueFrom:
                configMapKeyRef:
                  name: unidesk-dev-runtime-config
                  key: UNIDESK_SSH_CLIENT_ROUTE_ALLOWLIST
            - name: SESSION_SECRET
              valueFrom:
                secretKeyRef:
                  name: unidesk-dev-runtime-secrets
                  key: SESSION_SECRET
            - name: SESSION_TTL_SECONDS
              valueFrom:
                configMapKeyRef:
                  name: unidesk-dev-runtime-config
                  key: SESSION_TTL_SECONDS
            - name: UNIDESK_DATABASE_NAME
              value: unidesk_dev
            - name: UNIDESK_DEPLOY_REF
              value: origin/master:deploy.json#environments.dev.services.frontend
            - name: UNIDESK_DEPLOY_SERVICE_ID
              value: frontend
            - 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/frontend-dev.jsonl
          volumeMounts:
            - name: logs
              mountPath: /var/log/unidesk-dev
          readinessProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 20
          livenessProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 10
            timeoutSeconds: 3
            failureThreshold: 6
          startupProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 60
          resources:
            requests:
              cpu: 80m
              memory: 128Mi
            limits:
              memory: 512Mi
      volumes:
        - name: logs
          emptyDir: {}
