{{- if and .Values.managementController.enabled .Values.rbac.installClusterRoles }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: kargo-management-controller
  labels:
    {{- include "kargo.labels" . | nindent 4 }}
    {{- include "kargo.managementController.labels" . | nindent 4 }}
rules:
- apiGroups:
  - ""
  resources:
  - namespaces
  verbs:
  - create
  - get
  - list
  - patch
  - watch
- apiGroups:
  - ""
  resources:
  - configmaps
  - secrets
  - serviceaccounts
  verbs:
  - "*"
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - rolebindings
  - roles
  verbs:
  - "*"
- apiGroups:
  - kargo.akuity.io
  resources:
  - projects
  verbs:
  - delete
  - get
  - list
  - watch
- apiGroups:
  - kargo.akuity.io
  resources:
  - projects/status
  verbs:
  - patch
{{- end }}  
