{{- if eq .Values.global.platform "kubernetes" -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  labels:
    {{- include "gerrit-operator.labels" . | nindent 4 }}
  name: edp-{{ .Values.name }}
rules:
- apiGroups:
    - '*'
  resources:
    - gerrits
    - gerrits/finalizers
    - gerrits/status
    - gerritreplicationconfigs
    - gerritreplicationconfigs/status
    - gerritgroups
    - gerritgroups/status
  verbs:
    - '*'
- apiGroups:
    - '*'
  resources:
    - gerrits
    - gerrits/finalizers
    - gerrits/status
    - gerritreplicationconfigs
    - gerritreplicationconfigs/status
    - gerritgroups
    - gerritgroups/status
    - keycloaks
    - keycloaks/status
    - keycloakclients
    - keycloakclients/finalizers
    - keycloakclients/status
    - keycloakrealms
    - keycloakrealms/status
    - gerritgroups
    - gerritgroups/status
    - gerritgroupmembers
    - gerritgroupmembers/status
    - gerritgroupmembers/finalizers
    - gerritprojectaccesses
    - gerritprojectaccesses/status
    - gerritprojectaccesses/finalizers
    - gerritprojects
    - gerritprojects/status
    - gerritprojects/finalizers
    - gerritmergerequests
    - gerritmergerequests/status
    - gerritmergerequests/finalizers
    - events
  verbs:
    - '*'
- apiGroups:
    - coordination.k8s.io
  resources:
    - leases
  verbs:
    - create
    - get
    - list
    - update
{{ end }}
