apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: sysbench-memory
spec:
  serviceName: sysbench-memory
  podManagementPolicy: Parallel
  replicas: 0
  selector:
    matchLabels:
      app: sysbench-memory
  template:
    metadata:
      labels:
        app: sysbench-memory
    spec:
      nodeSelector:
        goal: service
      terminationGracePeriodSeconds: 0
      containers:
        - name: sysbench
          env:
            - name: threads
              valueFrom: {configMapKeyRef: { name: sysbench-memory, key: threads }}
            - name: memory
              valueFrom: {configMapKeyRef: { name: sysbench-memory, key: memory }}
            - name: cpus
              valueFrom: {configMapKeyRef: { name: sysbench-memory, key: cpus }}
            - name: report_interval
              valueFrom: {configMapKeyRef: { name: sysbench-memory, key: report_interval}}
            - name: extra
              valueFrom: {configMapKeyRef: { name: sysbench-memory, key: extra }}
#          image: severalnines/sysbench
          image: sysbench
          command:
            - sh
            - -c
            - "taskset -c $cpus sysbench --threads=$threads memory run --time=0 --memory-block-size=$memory --memory-total-size=0 --report-interval=$report_interval $extra"
  # required for workaround bug with kustomize https://github.com/kubernetes-sigs/kustomize/issues/504
  # when using commonLabels
  volumeClaimTemplates: []
