apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: node-feature-discovery

resources:
  - namespace.yaml

helmCharts:
- name: node-feature-discovery
  includeCRDs: true
  namespace: node-feature-discovery
  releaseName: node-feature-discovery
  version: 0.17.2
  repo: https://kubernetes-sigs.github.io/node-feature-discovery/charts
  valuesInLine:
    master:
      extraLabelNs: [gpu.intel.com]

patches:
  - target:
      kind: ConfigMap
      name: node-feature-discovery-worker-conf
    patch: |-
      - op: replace
        path: /data/nfd-worker.conf
        value: |-
          core:
            sources: 
            - "all"
          sources:
            usb:
              deviceClassWhitelist:
                - "02"
                - "08"
                - "0e"
                - "ef"
                - "fe"
                - "ff"
              deviceLabelFields:
                - "class"
                - "vendor"
                - "device"
            pci:
              deviceLabelFields:
                - "class"
                - "vendor"
                - "device"
                - "subsystem_vendor"
                - "subsystem_device"
            custom:
            - name: "intel-gpu" # Intel integrated GPU
              labels:
                "intel.feature.node.kubernetes.io/gpu": "true"
              matchFeatures:
              - feature: pci.device
                matchExpressions:
                  class: {op: In, value: ["0300"]}
                  vendor: {op: In, value: ["8086"]}