apiVersion: rbac.authorization.k8s.io/v1
{{ if eq .Values.installScope "cluster" }}
kind: ClusterRoleBinding
metadata:
  name: {{ include "app.fullname" . }}
roleRef:
  kind: ClusterRole
{{ else }}
kind: RoleBinding
metadata:
  name: {{ include "app.fullname" . }}
  namespace: {{ .Release.Namespace }}
roleRef:
  kind: Role
{{ end }}
  apiGroup: rbac.authorization.k8s.io
  name: {{ include "app.fullname" . }}
subjects:
- kind: ServiceAccount
  name: {{ include "service-account.name" . }}
  namespace: {{ .Release.Namespace }}
