{{- if and .Values.podSecurityPolicy.enabled .Values.rbac.create }}
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ include "mysql-operator.fullname" . }}-psp
  labels:
    {{- include "mysql-operator.labels" . | nindent 4 }}
rules:
- apiGroups: ['policy']
  resources: ['podsecuritypolicies']
  verbs:     ['use']
  resourceNames:
  - '{{ template "mysql-operator.fullname" . }}'
{{- end }}
