{{- if and .Values.rbac.create .Values.rbac.role.rules -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ template "redis.fullname" . }}
  labels:
    app: {{ template "redis.name" . }}
    chart: {{ template "redis.chart" . }}
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
rules:
{{ toYaml .Values.rbac.role.rules }}
{{- end -}}
