{{- if .Values.rbac.create }}
{{- if or .Values.certs.grpc.create .Values.certs.web.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  labels:
    app: {{ template "dex.name" . }}
    chart: {{ template "dex.chart" . }}
    heritage: "{{ .Release.Service }}"
    release: "{{ .Release.Name }}"
  name: {{ template "dex.fullname" . }}
  namespace: {{ .Release.Namespace }}
rules:
- apiGroups: [""]
  resources: ["configmaps", "secrets"]
  verbs: ["create", "delete"]
{{- end -}}
{{- end -}}
