---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sm-gpu
  labels:
    speechmatics.io/component: sm-gpu-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: sm-gpu
  template:
    metadata:
      labels:
        app.kubernetes.io/name: sm-gpu
    spec:
      nodeSelector:
        gpu: "true"
      tolerations:
        - key: sku
          operator: Equal
          value: gpu
          effect: NoSchedule
      containers:
        - name: "sm-gpu-server"
          image: "speechmatics-docker-public.jfrog.io/sm-gpu-inference-server-en:12.0.0"
          env:
            - name: NVIDIA_REQUIRE_CUDA
              value: "cuda>=11.8"
            - name: SM_LICENSE_FILE
              value: /etc/secrets/license.json
#           The inference server runs in batch mode by default. To run in realtime mode, set SM_BATCH_MODE to false.
#           - name: SM_BATCH_MODE
#             value: ("true"|"false")
#           To save resource, you can opt to only load one operating point.
#           - name: SM_OPERATING_POINT
#             value: ("standard"|"enhanced")
          ports:
            - name: sm-gpu-http
              containerPort: 8000
            - name: sm-gpu-grpc
              containerPort: 8001
            - name: sm-gpu-metrics
              containerPort: 8002
          volumeMounts:
            - name: sm-gpu-license
              mountPath: "/etc/secrets"
              readOnly: true
          resources:
            limits:
              nvidia.com/gpu: 1
          livenessProbe:
            httpGet:
              path: /v2
              port: 8000
            periodSeconds: 20
          readinessProbe:
            httpGet:
              path: /v2/health/ready
              port: 8000
            periodSeconds: 20
      volumes:
        - name: sm-gpu-license
          secret:
            secretName: transcriber-license
            optional: false
