apiVersion: batch/v1
kind: Job
metadata:
  name: minigo-player
spec:
  parallelism: 16
  completions: 200000
  template:
    metadata:
      name: player
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: job-label
                operator: In
                values:
                - minigo-player
            topologyKey: kubernetes.io/hostname
      containers:
      - name: player
        image: gcr.io/$PROJECT/minigo-player:0.10
        imagePullPolicy: Always
        volumeMounts:
        - name: service-credentials
          mountPath: /etc/credentials
        env:
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /etc/credentials/service-account.json
        - name: BUCKET_NAME
          value: $BUCKET_NAME
        - name: BOARD_SIZE
          value: "$BOARD_SIZE"
        securityContext:
          privileged: true
      volumes:
      - name: service-credentials
        secret:
          secretName: $SERVICE_ACCOUNT-creds
      restartPolicy: OnFailure
