{{- if .Values.rbac.create }}
{{- if .Values.rbac.pspEnabled }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
  name: psp-{{ template "prometheus-node-exporter.fullname" . }}
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: {{ .Release.Namespace }}
{{- end }}
{{- end }}
