{{- if .Values.global.rbacEnable }}
{{- if .Values.global.pspEnable }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  labels:
    app: {{ template "grafana.fullname" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: psp-{{ template "grafana.server.fullname" . }}
rules:
- apiGroups: ['extensions']
  resources: ['podsecuritypolicies']
  verbs:     ['use']
  resourceNames:
  - {{ template "grafana.server.fullname" . }}
{{- end }}
{{- end }}
