# helm_charts_admission-cluster-role-binding.yaml
{{- if and .Values.rbac.create  .Values.deployments.admissionController -}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: {{ template "admission-controller.fullname" . }}
  labels:
    app.kubernetes.io/name: {{ include "admission-controller.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    helm.sh/chart: {{ include "couchbase-operator.chart" . }}
subjects:
- kind: ServiceAccount
  name: {{ template "admission-controller.serviceAccountName" . }}
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: {{ template "admission-controller.fullname" . }}
{{- end }}