apiVersion: batch/v1
kind: Job
metadata:
  name: sapawarga-queue-import
  namespace: sapawarga
spec:
  parallelism: 1
  template:
    metadata:
      name: sapawarga-queue-import
    spec:
      containers:
        - name: api
          image: registry.gitlab.com/jdsteam/sapa-warga/sapawarga-app/sapawarga-backend-api:%VERSION%
          command: ["php", "yii", "queue-import/listen", "--verbose"]
          env:
            - name: MYSQL_HOST
              valueFrom:
                configMapKeyRef:
                  name: sapawarga-backend-config-env
                  key: MYSQL_HOST
            - name: MYSQL_USER
              valueFrom:
                secretKeyRef:
                  name: sapawarga-backend-secret
                  key: MYSQL_USER
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: sapawarga-backend-secret
                  key: MYSQL_PASSWORD
            - name: FCM_KEY
              valueFrom:
                secretKeyRef:
                  name: sapawarga-backend-secret
                  key: FCM_KEY
            - name: MYSQL_DATABASE
              valueFrom:
                configMapKeyRef:
                  name: sapawarga-backend-config-env
                  key: MYSQL_DATABASE
            - name: COOKIE_VALIDATION_KEY
              valueFrom:
                secretKeyRef:
                  name: sapawarga-backend-secret
                  key: COOKIE_VALIDATION_KEY
      imagePullSecrets:
        - name: regcred
      restartPolicy: OnFailure
