apiVersion: batch/v1
kind: Job
metadata:
  name: perf-tool-compare
  namespace: "{{ .NAMESPACE }}"
spec:
  completions: 1
  template:
    metadata:
      labels:
        tag: compare
    spec:
      containers:
        - name: perf-tool-compare
          image: datafuselabs/perf-tool:latest
          command:
            - sh
            - "-c"
            - |
              /bin/bash <<'EOF'
              echo "Start compare"
              mkdir -p current
              mkdir -p ref
              mkdir -p result

              python3 compare.py --region {{ .REGION }} \
                                --bucket {{ .BUCKET }} --secretID {{ .SECRET_ID }}  \
                                --secretKey {{ .SECRET_KEY }} --type COS \
                                --releaser ./current --pull ./ref \
                                --rpath {{ .LEFT }} --ppath {{ .RIGHT }} -o {{ .PATH }} \
                                --endpoint {{ .ENDPOINT }} --currentLogLink {{ .LEFT_LOG }} --refLogLink {{ .RIGHT_LOG }}
              exit 0
              EOF
      restartPolicy: Never
  backoffLimit: 10