apiVersion: batch/v1
kind: Job
metadata:
  name: mattermost-bulk-load
spec:
  template:
    spec:
      restartPolicy: Never
      containers:
        - name: mattermost-load-test-container
          image: mattermost/mattermost-loadtest:5.11
          imagePullPolicy: Always
          volumeMounts:
          - mountPath: /mattermost-load-test/loadtestconfig.json
            name: loadtestconfig-json
            subPath: loadtestconfig.json
          env:
          - name: MM_CONFIG
            value: "%DATA_SOURCE%"
          command: ["/bin/bash","-c","./bin/loadtest genbulkload && /mattermost/bin/mattermost import bulk --workers 2 --apply /mattermost-load-test/loadtestbulkload.json"]
      volumes:
        - name: loadtestconfig-json
          configMap:
            name: mattermost-loadtestconfig-json
            items:
            - key: loadtestconfig.json
              path: loadtestconfig.json
