apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-resnet50-onnx-server
  labels:
    app: backend-resnet50-onnx-server
  namespace: serving-pattern
spec:
  selector:
    matchLabels:
      app: backend-resnet50-onnx-server
  replicas: 2
  template:
    metadata:
      labels:
        app: backend-resnet50-onnx-server
      name: backend-resnet50-onnx-server
    spec:
      containers:
        - name: backend-resnet50-onnx-server
          image: shibui/ml-system-in-action:serving_patterns_backend_resnet50_onnx_server
          command: ["./run_backend.sh"]
          env:
            - name: PLATFORM
              value: kubernetes
            - name: CACHE_HOST
              value: redis.serving-pattern.svc.cluster.local
            - name: MODEL_INTERFACE
              value: /serving_patterns/src/app/ml/resnet50_onnx_server/model/resnet50_onnx_server.yaml
            - name: NUM_PROCS
              value: "4"
            - name: BATCH_CODE
              value: "src.app.backend.prediction_batch"
            - name: PREDICTOR
              value: "src.app.api._predict_image"
            - name: ONNX_RUNTIME_SERVER_HTTP
              value: server-resnet50-onnx-server.serving-pattern.svc.cluster.local:8001
            - name: MODEL_NAME
              value: default
            - name: VERSION
              value: "1"
            - name: PROFILE
              value: "1"
            - name: QUEUE_NAME
              value: resnet50_api_server_queue
          resources:
            limits:
              cpu: "2"
              memory: "4000Mi"
            requests:
              cpu: "2"
              memory: "4000Mi"
