# helm_charts_mgmt-clusterrolebinding.yaml
{{- if (and .Values.rbac.create .Values.mgmt.enabled) -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  labels:
    app: {{ template "opa.name" . }}
    chart: {{ template "opa.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    component: mgmt
  name: {{ template "opa.mgmtfullname" . }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: {{ template "opa.mgmtfullname" . }}
subjects:
  - kind: ServiceAccount
    name: {{ template "opa.serviceAccountName" . }}
    namespace: {{ .Release.Namespace }}
{{- end -}}