# based on:
#
#   https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/device-plugins/nvidia-gpu/daemonset.yaml
#
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nvidia-gpu-device-plugin
  namespace: kube-system
  labels:
    application: nvidia-gpu-device-plugin
    version: 4baa941d8df91e5dc1736adea74ce54e564dd782
spec:
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      application: nvidia-gpu-device-plugin
  template:
    metadata:
      labels:
        application: nvidia-gpu-device-plugin
        version: 4baa941d8df91e5dc1736adea74ce54e564dd782
      annotations:
        logging/destination: "{{.Cluster.ConfigItems.log_destination_infra}}"
    spec:
      serviceAccountName: nvidia
      tolerations:
      - operator: Exists
        effect: NoExecute
      - operator: Exists
        effect: NoSchedule
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: zalando.org/nvidia-gpu
                operator: Exists
      priorityClassName: system-node-critical
      volumes:
      - name: device-plugin
        hostPath:
          path: /var/lib/kubelet/device-plugins
      - name: dev
        hostPath:
          path: /dev
      containers:
      - name: nvidia-gpu-device-plugin
        image: registry.opensource.zalan.do/teapot/nvidia-gpu-device-plugin:4baa941d8df91e5dc1736adea74ce54e564dd782
        command:
        - /usr/bin/nvidia-gpu-device-plugin
        - -host-path=/opt/nvidia
        - -logtostderr
        resources:
          requests:
            cpu: 50m
            memory: 10Mi
          limits:
            cpu: 50m
            memory: 10Mi
        securityContext:
          privileged: true
        volumeMounts:
        - name: device-plugin
          mountPath: /device-plugin
        - name: dev
          mountPath: /dev
