apiVersion: batch/v1
kind: Job
metadata:
  name: broadcast
spec:
  backoffLimit: 1
  parallelism: 3  # number of pods scheduled concurrenctly
  template:
    metadata:
      labels:
        app: broadcast
    spec:
      nodeSelector:
        broadcastnodetype: broadcast
      restartPolicy: Never
      volumes:
      - name: google-cloud-key
        secret:
          secretName: pubsub-key
      containers:
      - name: broadcast
        image: jonasspenger/tamperproofbroadcast:latest
        imagePullPolicy: Always
        command: ["/bin/sh", "-c"]
        args:
        - echo running benchmark;
          MULTICHAINHOST=$(getent hosts multichain-headless | cut -d" " -f1); python3 tamperproofbroadcast/tests/benchmarks/benchmark.py --benchmark-duration=300 --benchmark-testid=fotb-3-$(hostname) fotb --multichain-host=$MULTICHAINHOST --multichain-port=7208 --multichain-chainname=chain@$MULTICHAINHOST --fotb-startheight=888;
          echo finished benchmark;
        volumeMounts:
        - name: google-cloud-key
          mountPath: /var/secrets/google
        env:
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /var/secrets/google/key.json
