{{- if and .Values.worker.enable .Values.worker.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ include "node-feature-discovery.fullname" . }}-worker
  namespace: {{ include "node-feature-discovery.namespace" . }}
  labels:
    {{- include "node-feature-discovery.labels" . | nindent 4 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ include "node-feature-discovery.fullname" . }}-worker
subjects:
- kind: ServiceAccount
  name: {{ include "node-feature-discovery.worker.serviceAccountName" . }}
  namespace: {{ include "node-feature-discovery.namespace" .  }}
{{- end }}

