# Copyright 2020 Cambricon, Inc.
#
# 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: v1
kind: Pod
metadata:
  name: cambricon-device-plugin-static-pod
  namespace: kube-system
spec:
  containers:
    - image: cambricon-k8s-device-plugin:v1.1.3
      name: cambricon-device-plugin-ctr
      command:
        - /usr/bin/k8s-device-plugin
      args:
        - --mode=default #device plugin mode: default, sriov or env-share
        - --virtualization-num=1 #  virtualization number for each MLU, used only in sriov mode or env-share mode
        #- --enable-console #uncomment to enable UART console device(/dev/ttyMS) in container
        #- --disable-health-check #uncomment to disable health check
      securityContext:
        privileged: true
      volumeMounts:
        - name: device-plugin
          mountPath: /var/lib/kubelet/device-plugins
        # mount sys if sriov mode is enabled
        - name: sys
          mountPath: /sys
  volumes:
    - name: device-plugin
      hostPath:
        path: /var/lib/kubelet/device-plugins
    # mount sys if sriov mode is enabled
    - name: sys
      hostPath:
        path: /sys
