# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: tritonserver
  labels:
    name: tritonserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tritonserver
  template:
    metadata:
      labels:
        app: tritonserver
    spec:
      containers:
        - name: tritonserver
          image: nvcr.io/nvidia/tritonserver:20.09-py3
          imagePullPolicy: IfNotPresent
          resources:
            limits:
              nvidia.com/gpu: 1
          env:
            - name: LD_PRELOAD
              value: ''
          args: ["tritonserver", "--model-store=gs://MODEL_REPOSITORY_BUCKET/model_repository/",
                 "--strict-model-config=false",
                 "--log-verbose=1"]
          ports:
            - containerPort: 8000
              name: http
            - containerPort: 8001
              name: grpc
            - containerPort: 8002
              name: metrics
          livenessProbe:
            httpGet:
              path: /v2/health/live
              port: http
            initialDelaySeconds: 100
            periodSeconds: 5
            timeoutSeconds: 1
            successThreshold: 1
            failureThreshold: 30
          readinessProbe:
            httpGet:
              path: /v2/health/ready
              port: http
            initialDelaySeconds: 100
            periodSeconds: 5
            timeoutSeconds: 1
            successThreshold: 1
            failureThreshold: 30
          securityContext:
            runAsUser: 1000
