apiVersion: apps/v1
kind: Deployment
metadata:
  name: resnetinfer1-1-deploy
  labels:
      app: infers
spec:
  replicas: 1
  selector:
    matchLabels:
      app: infers
  template:
    metadata:
      labels:
         app: infers
         host-arch: huawei-arm         # Select the os arch. If the os arch is arm, change it to huawei-x86.
         npu-310-strategy: card        # Select the 310 scheduling policy. If choose to schedule by chip, change it to chip.
         fault-scheduling: grace       # Add this Labels, will reschedule pods in the event of chip failures.
         ring-controller.atlas: ascend-310 # Add this Label, used to check job kind.
    spec:
      schedulerName: volcano
      automountServiceAccountToken: false
      containers:
      - image: ubuntu-infer:v1                  # Inference image name
        imagePullPolicy: IfNotPresent
        name: resnet50infer
        env:
        # ASCEND_VISIBLE_DEVICES env variable is used by ascend-docker-runtime when in the whole card scheduling scene with volcano scheduler. please delete it when in the static or dynamic vNPU scheduling scene or without volcano.
        - name: ASCEND_VISIBLE_DEVICES
          valueFrom:
            fieldRef:
              fieldPath: metadata.annotations['huawei.com/Ascend310']               # The value must be the same as resources.requests. If the Ascend 310P Processor is used, change it to huawei.com/Ascend310P.
        resources:
          requests:
            huawei.com/Ascend310: 1             # Number of the Ascend 310 Processors. If the Ascend 310P Processor is used, change it to huawei.com/Ascend310P.
          limits:
            huawei.com/Ascend310: 1             # The value should be the same as that of requests . If the Ascend 310P Processor is used, change it to huawei.com/Ascend310P.
        volumeMounts:
        - name: slog
          mountPath: /var/log/npu/conf/slog/    #Log path
        - name: localtime                       #The container time must be the same as the host time.
          mountPath: /etc/localtime
      volumes:
      - name: slog
        hostPath:
          path: /var/log/npu/conf/slog/
      - name: localtime
        hostPath:
          path: /etc/localtime