# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020 Intel Corporation

---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: "{{ .Release.Name }}"
  labels:
    app: "{{ .Release.Name }}"
spec:
  selector:
    matchLabels:
      app: "{{ .Release.Name }}"
  template:
    metadata:
      labels:
        app: "{{ .Release.Name }}"
    spec:
      containers:
      - name: "{{ .Release.Name }}"
        env:
          - name: NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
        image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
        imagePullPolicy: "{{ .Values.pullPolicy }}"
        securityContext:
          readOnlyRootFilesystem: true
        volumeMounts:
        - name: devfs
          mountPath: /dev/dri
          readOnly: true
        - name: sysfs
          mountPath: /sys/class/drm
          readOnly: true
        - name: kubeletsockets
          mountPath: /var/lib/kubelet/device-plugins
      volumes:
      - name: devfs
        hostPath:
          path: /dev/dri
      - name: sysfs
        hostPath:
          path: /sys/class/drm
      - name: kubeletsockets
        hostPath:
          path: /var/lib/kubelet/device-plugins
      nodeSelector:
        "{{ .Values.nodeSelector }}": "yes"
