apiVersion: apps/v1
kind: Deployment
metadata:
  name: jugaralpadel
  namespace: <NS>
  labels:
    app: jugaralpadel
    app.kubernetes.io/part-of: jugaralpadel
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jugaralpadel
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: jugaralpadel
    spec:
      containers:
      - name: jugaralpadel
        image: <REGISTRO>/jugaralpadel:<TAG>
        env:
        - name: IMG_VERSION
          value: "<TAG>"
        - name: DEBUG
          valueFrom:
            configMapKeyRef:
              key: DEBUG
              name: env-prod
        - name: MES_COMIENZO_TEMPORADA
          valueFrom:
            configMapKeyRef:
              key: MES_COMIENZO_TEMPORADA
              name: env-prod
        - name: DATABASE
          valueFrom:
            configMapKeyRef:
              key: DATABASE
              name: env-prod
        - name: SQL_HOST
          valueFrom:
            configMapKeyRef:
              key: SQL_HOST
              name: env-prod
        - name: SQL_PORT
          valueFrom:
            configMapKeyRef:
              key: SQL_PORT
              name: env-prod
        - name: SQL_ENGINE
          valueFrom:
            configMapKeyRef:
              key: SQL_ENGINE
              name: env-prod
        - name: SQL_DATABASE
          valueFrom:
            configMapKeyRef:
              key: SQL_DATABASE
              name: env-prod
        - name: SQL_USER
          valueFrom:
            configMapKeyRef:
              key: SQL_USER
              name: env-prod
        - name: SQL_PASSWORD
          valueFrom:
            configMapKeyRef:
              key: SQL_PASSWORD
              name: env-prod        
        - name: ADMIN_EMAIL
          valueFrom:
            configMapKeyRef:
              key: ADMIN_EMAIL
              name: env-prod        
        - name: APP_VERSION
          valueFrom:
            configMapKeyRef:
              key: APP_VERSION
              name: env-prod
        ports:
        - containerPort: 8000
          protocol: TCP
        volumeMounts:
        - mountPath: /app/mediafiles
          name: jugaralpadel-media

        - mountPath: /app/eventos/migrations
          name: jugaralpadel-eventos-migrations

        - mountPath: /app/gestion_reservas/migrations
          name: jugaralpadel-gestionreservas-migrations

        - mountPath: /app/reymotausers/migrations
          name: jugaralpadel-reymotausers-migrations

        - mountPath: /app/staticfiles
          name: static-volume
      imagePullSecrets:
      - name: myregistrykey
      restartPolicy: Always
      volumes:
      - name: jugaralpadel-media
        persistentVolumeClaim:
          claimName: jugaralpadel-media

      - name: jugaralpadel-eventos-migrations
        persistentVolumeClaim:
          claimName: jugaralpadel-eventos-migrations

      - name: jugaralpadel-gestionreservas-migrations
        persistentVolumeClaim:
          claimName: jugaralpadel-gestionreservas-migrations
          
      - name: jugaralpadel-reymotausers-migrations
        persistentVolumeClaim:
          claimName: jugaralpadel-reymotausers-migrations

      - name: static-volume
        persistentVolumeClaim:
          claimName: static-volume
status: {}
