apiVersion: apps/v1
kind: Deployment
metadata:
  name: purple-lab
  labels:
    app: purple-lab
spec:
  replicas: 2
  selector:
    matchLabels:
      app: purple-lab
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: purple-lab
    spec:
      serviceAccountName: purple-lab
      securityContext:
        runAsNonRoot: true
        runAsUser: 1000
        fsGroup: 1000
      containers:
        - name: purple-lab
          image: asklokesh/purple-lab:latest
          imagePullPolicy: Always
          ports:
            - name: http
              containerPort: 57375
              protocol: TCP
          envFrom:
            - configMapRef:
                name: purple-lab-config
            - secretRef:
                name: purple-lab-secrets
          resources:
            requests:
              memory: "256Mi"
              cpu: "250m"
            limits:
              memory: "1Gi"
              cpu: "1000m"
          livenessProbe:
            httpGet:
              path: /health
              port: http
            initialDelaySeconds: 15
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /health
              port: http
            initialDelaySeconds: 5
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 3
          volumeMounts:
            - name: project-storage
              mountPath: /projects
      volumes:
        - name: project-storage
          persistentVolumeClaim:
            claimName: purple-lab-projects
