{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels: {{- include "opensearch-dashboards.labels" . | nindent 4 }}
  name: {{ template "opensearch-dashboards.fullname" . }}-dashboards-rolebinding
roleRef:
  kind: Role
  name: {{ template "opensearch-dashboards.serviceAccountName" . }}
  apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
  name: {{ template "opensearch-dashboards.serviceAccountName" . }}
  namespace: {{ .Release.Namespace }}
{{- end }}
