# helm_charts_couchbase-cluster-role-binding.yaml
{{- if and .Values.rbac.create  .Values.deployments.couchbaseOperator -}}
---
kind: {{ printf "%sBinding" (include "couchbase-operator.rbacRole" .) }}
apiVersion: rbac.authorization.k8s.io/{{ required "A valid .Values.rbac.apiVersion entry required!" .Values.rbac.apiVersion }}
metadata:
  name: {{ template "couchbase-operator.fullname" . }}
  labels:
    app.kubernetes.io/name: {{ include "couchbase-operator.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 "couchbase-operator.serviceAccountName" . }}
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: {{ template "couchbase-operator.rbacRole" . }}
  name: {{ template "couchbase-operator.fullname" . }}
{{- end }}