{{- if .Values.rbacEnable }}
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  labels:
    app: {{ template "cassandra-operator.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: {{ template "cassandra-operator.name" . }}
subjects:
- kind: ServiceAccount
  labels:
      app: {{ template "cassandra-operator.name" . }}
      chart: {{ .Chart.Name }}-{{ .Chart.Version }}
      heritage: {{ .Release.Service }}
      release: {{ .Release.Name }}
  name: {{ template "cassandra-operator.name" . }}
roleRef:
  kind: Role
  name: {{ template "cassandra-operator.name" . }}
  apiGroup: rbac.authorization.k8s.io
{{- end }}
