{{- if .Values.Secure.Enabled }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}"
  labels:
    heritage: {{ .Release.Service | quote }}
    release: {{ .Release.Name | quote }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    component: "{{ .Release.Name }}-{{ .Values.Component }}"
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}"
subjects:
- kind: ServiceAccount
  name: {{ template "cockroachdb.serviceAccountName" . }}
  namespace: {{ .Release.Namespace | quote }}
{{- end }}