apiVersion: apps/v1
kind: Deployment
metadata:
  name: migrator
  labels:
    app: migrator
spec:
  selector:
    matchLabels:
      app: migrator
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: migrator
        tier: frontend
    spec:
      serviceAccountName: migrator-serviceaccount
      containers:
      - image: XXX.dkr.ecr.XXX.amazonaws.com/migrator:v2020.1.0
        name: migrator
        env:
        - name: AWS_REGION
          value: XXX
        - name: DATABASE_USERNAME
          valueFrom:
            secretKeyRef:
              name: database-credentials-bd8htk2bk7
              key: username
        - name: DATABASE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: database-credentials-bd8htk2bk7
              key: password
        - name: DATABASE_NAME
          valueFrom:
            secretKeyRef:
              name: database-credentials-bd8htk2bk7
              key: database
        - name: DATABASE_HOST
          valueFrom:
            secretKeyRef:
              name: database-credentials-bd8htk2bk7
              key: host
        ports:
        - containerPort: 8080
          name: migrator
