apiVersion: v1
kind: Pod
metadata:
  name: maestro-client
spec:
  restartPolicy: Never
  affinity:
    nodeAffinity:
      preferredDuringSchedulingIgnoredDuringExecution:
        - weight: 1
          preference:
            matchExpressions:
              - key: nodetype
                operator: In
                values:
                  - maestroperf
  containers:
    - name: client
      image: maestroperf/maestro-client:1.5.5
      command:
        - /bin/bash
        - -c
        - /opt/maestro/maestro-cli/bin/maestro-cli exec -s ${TEST_CASE}
      env:
        - name: MAESTRO_BROKER
          value: mqtt://broker
        - name: SEND_RECEIVE_URL
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: sendReceiveUrl
              optional: true
        - name: SEND_URL
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: sendUrl
              optional: true
        - name: RECEIVE_URL
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: receiveUrl
              optional: true
        - name: MESSAGE_SIZE
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: messageSize
              optional: true
        - name: RATE
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: rate
              optional: true
        - name: TEST_DURATION
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: testDuration
              optional: true
        - name: TEST_DESCRIPTION
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: testDescription
              optional: true
        - name: TEST_COMMENT
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: testComment
              optional: true
        - name: PARALLEL_COUNT
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: parallelCount
              optional: true
        - name: DISTRIBUTION_STRATEGY
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: distributionStrategy
              optional: true
        - name: LOG_LEVEL
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: logLevel
              optional: true
        - name: INSPECTOR_NAME
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: inspectorName
              optional: true
        - name: MANAGEMENT_INTERFACE
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: managementInterface
              optional: true
        - name: ENDPOINT_RESOLVER_NAME
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: endpointResolverName
              optional: true
        - name: TEST_CASE
          valueFrom:
            configMapKeyRef:
              name: client-config
              key: testCase
      volumeMounts:
        - mountPath: /opt/maestro/maestro-cli/scripts
          name: config
        - mountPath: /test-scripts
          name: test-scripts
  volumes:
    - name: config
      configMap:
        name: client-config
    - name: test-scripts
      configMap:
        name: test-scripts
