{{- if .Values.rbac.create }}
{{- if .Values.rbac.pspEnabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: psp-{{ template "prometheus-node-exporter.fullname" . }}
  labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: psp-{{ template "prometheus-node-exporter.fullname" . }}
subjects:
  - kind: ServiceAccount
    name: {{ template "prometheus-node-exporter.fullname" . }}
    namespace: {{ template "prometheus-node-exporter.namespace" . }}
{{- end }}
{{- end }}
