{{- if and .Values.podSecurityPolicy.enabled .Values.rbac.create }}
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ include "mysql-operator.fullname" . }}-psp
  labels:
    {{- include "mysql-operator.labels" . | nindent 4 }}
roleRef:
  kind: Role
  name: {{ template "mysql-operator.fullname" . }}-psp
  apiGroup: rbac.authorization.k8s.io
subjects:
# Authorize specific service accounts:
- kind: ServiceAccount
  name: {{ template "mysql-operator.serviceAccountName" . }}
  namespace: {{ .Release.Namespace | quote }}
{{- end }}
