# NOTE: This file is not the source of truth for GKE device plugins. Modifying this file would have no effect on GKE clusters.
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    k8s-app: nvidia-gpu-device-plugin
  name: nvidia-gpu-device-plugin
  namespace: kube-system
spec:
  selector:
    matchLabels:
      k8s-app: nvidia-gpu-device-plugin
  template:
    metadata:
      labels:
        k8s-app: nvidia-gpu-device-plugin
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: cloud.google.com/gke-accelerator
                    operator: Exists
      containers:
        - command:
            - /usr/bin/nvidia-gpu-device-plugin
            - -logtostderr
            - --enable-container-gpu-metrics
            - --enable-health-monitoring
          env:
            - name: XID_CONFIG
              valueFrom:
                configMapKeyRef:
                  key: HealthCriticalXid
                  name: xid-config
                  optional: true
            - name: LD_LIBRARY_PATH
              value: /usr/local/nvidia/lib64
            - name: GOMAXPROCS
              value: "1"
          image: gcr.io/gke-release/nvidia-gpu-device-plugin@sha256:6b25281cd0fa3ca55f3e837a18be4a14b44952105568f466530dd85bcebde62f
          name: nvidia-gpu-device-plugin
          ports:
            - containerPort: 2112
              name: metrics
          resources:
            limits:
              memory: 100Mi
            requests:
              cpu: 50m
              memory: 100Mi
          securityContext:
            privileged: true
          volumeMounts:
            - mountPath: /device-plugin
              name: device-plugin
            - mountPath: /dev
              name: dev
            - mountPath: /usr/local/nvidia
              name: nvidia
            - mountPath: /var/lib/kubelet/pod-resources
              name: pod-resources
            - mountPath: /proc
              name: proc
            - mountPath: /etc/nvidia
              name: nvidia-config
      priorityClassName: system-node-critical
      restartPolicy: Always
      securityContext:
        seccompProfile:
          type: RuntimeDefault
      tolerations:
        - effect: NoExecute
          operator: Exists
        - effect: NoSchedule
          operator: Exists
      volumes:
        - hostPath:
            path: /var/lib/kubelet/device-plugins
            type: Directory
          name: device-plugin
        - hostPath:
            path: /dev
            type: Directory
          name: dev
        - hostPath:
            path: /var/lib/kubelet/pod-resources
            type: Directory
          name: pod-resources
        - hostPath:
            path: /proc
            type: Directory
          name: proc
        - hostPath:
            path: /etc/nvidia
            type: DirectoryOrCreate
          name: nvidia-config
        - hostPath:
            path: /home/kubernetes/bin/nvidia
            type: Directory
          name: nvidia
  updateStrategy:
    type: RollingUpdate
