apiVersion: batch/v1
kind: Job
metadata:
  name: parallel-job
spec:
  completions: 6 # number of times to run
  parallelism: 2 # number of pods that can run in parallel
  backoffLimit: 6 # number of retries before throwing error
  activeDeadlineSeconds: 10 # time to allow job to run
  template:
    metadata:
      labels:
        app: kubernetes-series
        tier: job
    spec:
      restartPolicy: OnFailure
      containers:
        - name: job
          image: gcr.io/PROJECT_NAME/batchjob-container-job:latest
          # environment variables for the Pod
          env:
          - name: GCLOUD_PROJECT
            value: PROJECT_NAME
          - name: MESSAGE
            value: I am a parallel run job
          - name: FOREIGN_SERVICE
            value: http://endpoints.default.svc.cluster.local/parallel
          - name: NODE_ENV
            value: production
          ports:
          - containerPort: 80