apiVersion: apps/v1
kind: Deployment
metadata:
  name: fio-tools
spec:
  selector:
    matchLabels:
      app: fio-tools
  template:
    metadata:
      labels:
        app: fio-tools
    spec:
        volumes:
        - name: data
          persistentVolumeClaim:
            claimName: local
            # claimName: ceph
        - name: benchmarks
          emptyDir: {}
        - name: plots
          emptyDir: {}
        containers:
        - name: fio-frontend
          imagePullPolicy: Always
          image: artmr/fio-http-server:0.1
          volumeMounts:
          - name: benchmarks
            mountPath: /server/benchmarks
          - name: plots
            mountPath: /server/plots
          ports:
          - containerPort: 8000
        initContainers:
        - name: fio-gen-data
          imagePullPolicy: Always
          image: artmr/fio-gen-data:0.1
          args: ["/app/job-templates/random-template.fio"]
          volumeMounts:
          - name: data 
            mountPath: /app/data
          - name: benchmarks
            mountPath: /app/benchmarks
          env:
            - name: OUTPUT_DIR
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.output-dir
            - name: BLOCK_SIZE
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.block-size
            - name: DIRECT
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.direct
            - name: DIRECTORY
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.directory
            - name: FILENAME
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.filename
            - name: IO_ENGINE
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.io-engine
            - name: LOG_AVG_MSEC
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.log-avg-msec
            - name: RAND_REPEAT
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.rand-repeat
            - name: RUNTIME
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.runtime
            - name: SIZE
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.size
            - name: TIME_BASED
              valueFrom:
                configMapKeyRef:
                  name: fio-tools
                  key: gen-data.time-based
        - name: fio-gen-plots
          imagePullPolicy: Always
          image: artmr/fio-gen-plots:0.1
          args: ["-L", "-i", "/benchmarks"]
          volumeMounts:
          - name: benchmarks
            mountPath: /benchmarks
          - name: plots
            mountPath: /plots
