apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: edgetpu-device-plugin
  namespace: kube-system
spec:
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      name: edgetpu-device-plugin
  template:
    metadata:
      labels:
        name: edgetpu-device-plugin
      # Mark this pod as a critical add-on; when enabled, the critical add-on scheduler
      # reserves resources for critical add-on pods so that they can be rescheduled after
      # a failure.  This annotation works in tandem with the toleration below.
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ""
    spec:
      tolerations:
      # Allow this pod to be rescheduled while the node is in "critical add-ons only" mode.
      # This, along with the annotation above marks this pod as a critical add-on.
      - key: CriticalAddonsOnly
        operator: Exists
      - key: revoman.org/edgetpu
        operator: Exists
        effect: NoSchedule
      containers:
      - name: edgetpu-device-plugin
        image: quay.io/revoman/edgetpu-device-plugin:arm32
        imagePullPolicy: Always
        command:
          - /bin/edgetpu-device-plugin
          - -v=99
        securityContext:
          privileged: true
        volumeMounts:
        - name: devfs
          mountPath: /dev
        - name: sysfs
          mountPath: /sys
        - name: device-plugin
          mountPath: /var/lib/kubelet/device-plugins
      volumes:
      - name: devfs
        hostPath:
          path: /dev
      - name: sysfs
        hostPath:
          path: /sys
      - name: device-plugin
        hostPath:
          path: /var/lib/kubelet/device-plugins
