---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: scoreboard
spec:
  replicas: 1
  selector:
    matchLabels:
      component: scoreboard
  strategy:
    rollingUpdate:
      maxSurge: 50%
      maxUnavailable: 50%
  template:
    metadata:
      labels:
        component: scoreboard
    spec:
      containers:
        - name: scoreboard
          image: registry.cri.epita.fr/risson/scoreboard-seedbox-cri/master
          ports:
            - name: http
              containerPort: 8000
              protocol: TCP
          startupProbe:
            httpGet:
              path: /readiness
              port: http
          readinessProbe:
            httpGet:
              path: /readiness
              port: http
          livenessProbe:
            httpGet:
              path: /healthz
              port: http
          lifecycle:
            preStop:
              exec:
                command: ["/bin/sh", "-c", "sleep 5"]
          envFrom:
            - configMapRef:
                name: scoreboard-config
            - configMapRef:
                name: scoreboard-secret-path
          volumeMounts:
            - name: scoreboard-postgres-auth
              mountPath: /etc/scoreboard-postgres-auth
            - name: scoreboard-s3
              mountPath: /etc/scoreboard-s3
            - name: scoreboard-epita-oidc
              mountPath: /etc/scoreboard-epita-oidc
            - name: scoreboard-django-secrets
              mountPath: /etc/scoreboard-django-secrets
      volumes:
        - name: scoreboard-postgres-auth
          secret:
            secretName: scoreboard-seedbox-cri.acid-main-cluster.credentials
        - name: scoreboard-s3
          secret:
            secretName: scoreboard-s3
        - name: scoreboard-epita-oidc
          secret:
            secretName: scoreboard-epita-oidc
        - name: scoreboard-django-secrets
          secret:
            secretName: scoreboard-django-secrets
