{{- if and .Values.worker.enable .Values.worker.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ include "node-feature-discovery.fullname" . }}-worker
  namespace: {{ include "node-feature-discovery.namespace" . }}
  labels:
    {{- include "node-feature-discovery.labels" . | nindent 4 }}
rules:
  - apiGroups:
      - nfd.k8s-sigs.io
    resources:
      - nodefeatures
    verbs:
      - create
      - get
      - update
  - apiGroups:
      - ""
    resources:
      - pods
    verbs:
      - get
{{- end }}