{{- if and .Values.serviceAccount.create  .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
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" . }}
rules:
- apiGroups:
    - ""
  resources:
    - endpoints
  verbs:
    - get
{{- end }}
