apiVersion: batch/v1
kind: Job
metadata:
  name: run-load-tests
  namespace: microservices
spec:
  selector: {}
  template:
    metadata:
      name: run-load-tests
    spec:
      tolerations:
        - key: node-role.kubernetes.io/master
          operator: Equal
          effect: NoSchedule
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                - key: node-role.kubernetes.io/master
                  operator: Exists
      containers:
      - name: gatling
        image: quay.io/virtuslab/gatling-tests:latest
        imagePullPolicy: Always
        env:
            # TODO MANIPULATE THIS
          - name: RAMP_UP_MAX
            value: "2300"
            # TODO MANIPULATE THIS
          - name: RAMP_UP_TIME
            value: "300"
          - name: PARADIGM
            valueFrom:
              secretKeyRef:
                name: paradigm
                key: paradigm
          - name: AUCTION_SERVICE_CONTACT_POINT
            value: "auction-house-primary.microservices.svc.cluster.local"
          - name: IDENTITY_SERVICE_CONTACT_POINT
            value: "identity-service-tertiary.microservices.svc.cluster.local"
          - name: GATLING_USE_S3
            value: "true"
          - name: AWS_ACCESS_KEY_ID
            valueFrom:
              secretKeyRef:
                name: aws
                key: key
          - name: AWS_SECRET_ACCESS_KEY
            valueFrom:
              secretKeyRef:
                name: aws
                key: secret
      restartPolicy: Never