apiVersion: batch/v1
kind: Job
metadata:
  name: homepage-migrate
spec:
  template:
    metadata:
      name: hompage-migrate
      labels:
        name: homepage-migrate
    spec:
      containers:
        - name: homepage-migrate
          image: asia.gcr.io/ianlewis-org/homepage
          command: ["/venv/bin/homepage", "migrate"]
          env:
            - name: DEBUG
              value: 'False'
            - name: SECRET_KEY
              valueFrom:
                secretKeyRef:
                  name: homepage-secret
                  key: secret-key
            - name: DB_HOST
              value: mysql
            - name: DB_USER
              valueFrom:
                secretKeyRef:
                  name: homepage-admin-secret
                  key: admin-user
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: homepage-admin-secret
                  key: admin-password
            - name: MEDIA_ROOT
              value: /var/www/media
            # - name: USE_MEMCACHED
            #   value: 'False'
            - name: ENV_DIR
              value: /etc/secrets
          resources:
            limits:
              memory: 150Mi
              cpu: 200m
            limits:
              memory: 150Mi
              cpu: 200m
      restartPolicy: Never
