---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: benchmark
  labels:
    app: benchmark
    hail.is/sha: "{{ code.sha }}"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: benchmark
  template:
    metadata:
      labels:
        app: benchmark
        hail.is/sha: "{{ code.sha }}"
    spec:
      nodeSelector:
        preemptible: "true"
      tolerations:
       - key: preemptible
         value: "true"
      containers:
        - name: benchmark
          image: "{{ benchmark_image.image }}"
          env:
          - name: HAIL_DOMAIN
            value: "{{ global.domain }}"
          - name: HAIL_DEPLOY_CONFIG_FILE
            value: /deploy-config/deploy-config.json
          - name: HAIL_SHA
            value: "{{ code.sha }}"
          - name: HAIL_CI_OAUTH_TOKEN
            value: /secrets/oauth-token/oauth-token
          ports:
            - containerPort: 5000
          resources:
            requests:
              memory: "250M"
              cpu: "100m"
            limits:
              memory: "1G"
              cpu: "1"
          volumeMounts:
            - name: session-secret-key
              mountPath: /session-secret-key
              readOnly: true
            - name: deploy-config
              mountPath: /deploy-config
              readOnly: true
            - name: ssl-config-benchmark
              mountPath: /ssl-config
              readOnly: true
            - name: benchmark-gsa-key
              mountPath: /benchmark-gsa-key
              readOnly: true
            - mountPath: /secrets/oauth-token
              name: hail-ci-0-1-github-oauth-token
              readOnly: true
          readinessProbe:
            tcpSocket:
              port: 5000
            initialDelaySeconds: 5
            periodSeconds: 5
      volumes:
        - name: session-secret-key
          secret:
            secretName: session-secret-key
        - name: deploy-config
          secret:
            secretName: deploy-config
        - name: ssl-config-benchmark
          secret:
            secretName: ssl-config-benchmark
        - name: benchmark-gsa-key
          secret:
            secretName: benchmark-gsa-key
        - name: hail-ci-0-1-github-oauth-token
          secret:
            secretName: hail-ci-0-1-github-oauth-token
