{{- if .Values.rbac.create }}
{{- if or .Values.certs.grpc.create .Values.certs.web.create .Values.crd.present }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
{{ include "dex.labels" . | indent 4 }}
  name: {{ template "dex.fullname" . }}
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ template "dex.fullname" . }}
subjects:
  - kind: ServiceAccount
    name: {{ template "dex.serviceAccountName" . }}
    namespace: {{ .Release.Namespace }}
{{- end -}}
{{- end -}}
