# Job that runs the set-ops soak test within the kubernetes cluster.
# This is used by run-k8s.sh.
apiVersion: batch/v1
kind: Job
metadata:
  name: soak-test-set-ops
  namespace: flow
spec:
  # Can change completions and parallelism to run n Jobs simultaneously.
  completions: 1
  parallelism: 1
  # Never restart failed pods.
  backoffLimit: 0
  template:
    spec:
      restartPolicy: Never
      containers:
        - name: set-ops-test
          image: quay.io/giantswarm/golang:1.16.3
          workingDir: /workdir
          command: ['bash', '/soak-test/entrypoint.sh']
          volumeMounts:
            - name: sources
              mountPath: /soak-test
          env:
            # For running against a local kuberentes deployment, you may need to scale these numbers
            # back so that the materialization is able to keep up with the rate of data. For
            # example, I found that more than ~200 ops per second was enough to make the tests
            # flakey with minikube, since it only uses 2 cores by default. YMMV
            # Setting VERIFY_PERIOD to longer durations can also help to smooth over variations in
            # the rate of processing, though the default of 30s seems to work fine.
            - name: STREAMS
              value: '100'
            - name: OPS_PER_SECOND
              value: '1000'
          envFrom:
            - secretRef: { name: postgres }
      volumes:
        - name: sources
          configMap: { name: set-ops-sources }

