apiVersion: batch/v1
kind: Job
metadata:
  name: backend-job
  namespace: production
spec:
  template:
    metadata:
      name: backend-job
    spec:
      containers:
      - name: backend-job
        image: openstatefoundation/open-raadsinformatie-backend
        imagePullPolicy: Always
        command: ["python"]
        args:
          - manage.py
          - extract
          - process
          - all
        envFrom:
        - configMapRef:
            name: config
        - secretRef:
            name: backend-credentials
        env:
          - name: POSTGRES_USERNAME
            valueFrom:
              secretKeyRef:
                name: secrets
                key: POSTGRES_USERNAME
          - name: POSTGRES_PASSWORD
            valueFrom:
              secretKeyRef:
                name: secrets
                key: POSTGRES_PASSWORD
      securityContext:
        runAsUser: 1000
        fsGroup: 1000
      restartPolicy: Never
      nodeSelector:
        cloud.google.com/gke-preemptible: "true"