apiVersion: batch/v1
kind: Job
metadata:
  name: manageiq-restore
spec:
  template:
    metadata:
      name: manageiq-restore
    spec:
      containers:
      - name: postgresql
        image: docker.io/manageiq/postgresql:latest
        command:
        - "/opt/manageiq/container-scripts/restore_db"
        env:
        - name: DATABASE_URL
          valueFrom:
            secretKeyRef:
              name: manageiq-secrets
              key: database-url
        - name: BACKUP_VERSION
          value: latest
        volumeMounts:
        - name: miq-backup-vol
          mountPath: "/backups"
        - name: miq-prod-vol
          mountPath: "/restore"
      volumes:
      - name: miq-backup-vol
        persistentVolumeClaim:
          claimName: manageiq-backup
      - name: miq-prod-vol
        persistentVolumeClaim:
          claimName: manageiq-postgresql
      restartPolicy: Never
