apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app: nvidia-container-toolkit-daemonset
  name: nvidia-container-toolkit-daemonset
  namespace: gpu-operator-resources
  annotations:
    openshift.io/scc: hostmount-anyuid
spec:
  selector:
    matchLabels:
      app: nvidia-container-toolkit-daemonset
  template:
    metadata:
      labels:
        app: nvidia-container-toolkit-daemonset
    spec:
      tolerations:
      - key: nvidia.com/gpu
        operator: Exists
        effect: NoSchedule
      serviceAccount: nvidia-container-toolkit
      hostPID: true
      initContainers:
      - name: driver-validation
        image: "FILLED_BY_THE_OPERATOR"
        imagePullPolicy: IfNotPresent
        command: ['sh', '-c']
        args: ["nvidia-validator"]
        env:
          - name: WITH_WAIT
            value: "true"
          - name: COMPONENT
            value: driver
        securityContext:
          privileged: true
          seLinuxOptions:
            level: "s0"
        volumeMounts:
          - name: driver-install-path
            mountPath: /run/nvidia/driver
            mountPropagation: Bidirectional
          - name: run-nvidia-validations
            mountPath: /run/nvidia/validations
            mountPropagation: Bidirectional
      containers:
      - image: "FILLED_BY_THE_OPERATOR"
        args: ["/usr/local/nvidia"]
        env:
        - name: RUNTIME_ARGS
          value: ""
        imagePullPolicy: IfNotPresent
        name: nvidia-container-toolkit-ctr
        securityContext:
          privileged: true
          seLinuxOptions:
            level: "s0"
        volumeMounts:
          - name: nvidia-run-path
            mountPath: /run/nvidia
            mountPropagation: Bidirectional
          - name: nvidia-local
            mountPath: /usr/local/nvidia
          - name: crio-hooks
            mountPath: /usr/share/containers/oci/hooks.d
      volumes:
        - name: nvidia-run-path
          hostPath:
            path: /run/nvidia
            type: DirectoryOrCreate
        - name: run-nvidia-validations
          hostPath:
            path: /run/nvidia/validations
            type: DirectoryOrCreate
        - name: driver-install-path
          hostPath:
            path: /run/nvidia/driver
        - name: nvidia-local
          hostPath:
            path: /usr/local/nvidia
        - name: crio-hooks
          hostPath:
            path: /run/containers/oci/hooks.d
