{{- if eq .Values.dashboard.enabled true }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    {{- include "tekton-dashboard.labels" . | nindent 4 }}
  name: tekton-dashboard-info
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: tekton-dashboard-info
subjects:
  - apiGroup: rbac.authorization.k8s.io
    kind: Group
    name: system:authenticated
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    {{- include "tekton-dashboard.labels" . | nindent 4 }}
  name: tekton-dashboard-backend
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: tekton-dashboard-backend
subjects:
  - kind: ServiceAccount
    name: {{ include "tekton-dashboard.name" . }}
    namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    {{- include "tekton-dashboard.labels" . | nindent 4 }}
  name: tekton-dashboard-tenant
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: tekton-dashboard-tenant
subjects:
  - kind: ServiceAccount
    name: {{ include "tekton-dashboard.name" . }}
    namespace: {{ .Release.Namespace }}
{{- end }}
