apiVersion: apps/v1
kind: Deployment
metadata:
  name: reymota
  namespace: <NS>
  labels:
    app: reymota
spec:
  replicas: 1
  selector:
    matchLabels:
      app: reymota
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: reymota
    spec:
      containers:
      - name: reymota
        image: <REGISTRO>/reymota:<TAG>
        env:
        - name: IMG_VERSION
          value: "<TAG>"
        - name: OPENSHIFT
          value: "False"
        - name: ENVIRONMENT
          valueFrom:
            configMapKeyRef:
              key: ENTORNO
              name: env-prod
        - name: DEBUG
          valueFrom:
            configMapKeyRef:
              key: DEBUG
              name: env-prod
        - name: LOCAL
          valueFrom:
            configMapKeyRef:
              key: LOCAL
              name: env-prod
        - name: APP_VERSION
          valueFrom:
            configMapKeyRef:
              key: APP_VERSION
              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
        ports:
        - containerPort: 8000
          protocol: TCP
        volumeMounts:
        - mountPath: /app/mediafiles
          name: reymota-media
        - mountPath: /app/lyrics/migrations
          name: reymota-lyrics-migrations
        - mountPath: /app/repostajes/migrations
          name: reymota-repostajes-migrations
        - mountPath: /app/reymotausers/migrations
          name: reymota-reymotausers-migrations

        - mountPath: /app/staticfiles
          name: static-volume
      imagePullSecrets:
      - name: myregistrykey
      restartPolicy: Always
      volumes:
      - name: reymota-media
        persistentVolumeClaim:
          claimName: reymota-media
      - name: reymota-lyrics-migrations
        persistentVolumeClaim:
          claimName: reymota-lyrics-migrations
      - name: reymota-repostajes-migrations
        persistentVolumeClaim:
          claimName: reymota-repostajes-migrations
      - name: reymota-reymotausers-migrations
        persistentVolumeClaim:
          claimName: reymota-reymotausers-migrations
      - name: static-volume
        persistentVolumeClaim:
          claimName: static-volume
status: {}
