# helm_charts_redis-ha-rolebinding.yaml
{{- if and .Values.serviceAccount.create .Values.rbac.create }}
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ template "redis-ha.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    app: {{ template "redis-ha.fullname" . }}
subjects:
- kind: ServiceAccount
  name: {{ template "redis-ha.serviceAccountName" . }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ template "redis-ha.fullname" . }}
{{- end }}