# This YAML file runs a job that spawns up multiple pods that execute a
# YCSB style workload against a pre-existing sofaster deployment. We're
# going to call this job "exec-ycsb".
apiVersion: batch/v1
kind: Job
metadata:
  name: exec-ycsb

spec:
  parallelism: 1

  # Pod templates for this job.
  template:
    # We're going to pull our images from a private azure registry for now.
    # Make sure you've configured a secret with Kubernetes for access to
    # this particular registry. We supply the IP addresses of servers in
    # the deployment through a secret. Please make sure this has been
    # configured with Kubernetes before creating.
    spec:
      restartPolicy: Never
      imagePullSecrets:
      - name: sofaster-cluster
      containers:
      - name: ycsb
        image: sofaster.azurecr.io/ycsb:tcp-latest
        imagePullPolicy: Always
        env:
        - name: SERVERS
          valueFrom:
            secretKeyRef:
              name: servers
              key: ips
        command: ["/SoFASTER/scripts/common/ycsb.py"]
        args: ["run", "--servers", "$(SERVERS)", "--no-fill"]
