apiVersion: v1
kind: Pod
metadata:
  namespace: default
  name: contacts1-migration
spec:
  restartPolicy: Never
  initContainers:
  - name: tmp-container
    image: contacts1-server:latest
    imagePullPolicy: Always
    volumeMounts:
    - mountPath: "/atlas-migrations"
      name: migrations
    command:
    - "cp"
    - "-r"
    - "/db/migrations"
    - "/atlas-migrations"
  containers:
  - name: migration
    env:
    - name: CONFIG_FILE
      value: defaults
    image: infoblox/migrate:latest
    imagePullPolicy: Always
    volumeMounts:
    - mountPath: /atlas-migrations
      name: migrations
    command:
    - /migrate
    args:
    - "--verbose"
    - "--source"
    - "file://atlas-migrations/migrations"
    - "--database.address"
    - "postgres.default:5432"
    - "--database.name"
    - "contacts1"
    - "--database.user"
    - "postgres"
    - "--database.password"
    - "postgres"
    - "up"
  volumes:
  - name: migrations
    emptyDir: {}