apiVersion: apps/v1
kind: Deployment
metadata:
  name: sqdc-dashboard
  namespace: sqdc-dashboard
  labels:
    app: sqdc-dashboard
spec:
  replicas: 2
  selector:
    matchLabels:
      app: sqdc-dashboard
  template:
    metadata:
      labels:
        app: sqdc-dashboard
    spec:
      imagePullSecrets:
      - name: registry-credentials
      containers:
      - name: dashboard
        image: gitea.vidoks.fr/sortifal/pfee:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        - containerPort: 3001
          name: api
          protocol: TCP
        env:
        - name: NODE_ENV
          value: "production"
        resources:
          requests:
            memory: "256Mi"
            cpu: "250m"
          limits:
            memory: "512Mi"
            cpu: "500m"
        livenessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 30
          periodSeconds: 10
          timeoutSeconds: 5
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 10
          periodSeconds: 5
          timeoutSeconds: 3
          failureThreshold: 2
        volumeMounts:
        - name: database
          mountPath: /app/database
      volumes:
      - name: database
        persistentVolumeClaim:
          claimName: sqdc-dashboard-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sqdc-dashboard-pvc
  namespace: sqdc-dashboard
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: standard
