{{- if and .Values.rbac.create .Values.rbac.pspEnabled }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ template "node-exporter.fullname" . }}-psp
  labels: {{- include "node-exporter.labels" . | nindent 4 }}
rules:
  - apiGroups: ['extensions']
    resources: ['podsecuritypolicies']
    verbs: ['use']
    resourceNames:
      - {{ template "node-exporter.fullname" . }}
{{- end }}
