{{- if eq .Values.global.platform "kubernetes" -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "codebase-operator.labels" . | nindent 4 }}
  name: edp-{{ .Values.name }}
rules:
- apiGroups:
    - argoproj.io
  resources:
    - applications
  verbs:
    - get
    - list
    - patch
    - update
    - watch
- apiGroups:
    - '*'
  resources:
    - gitservers
    - gitservers/status
    - gitservers/finalizers
    - codebases
    - codebases/status
    - codebases/finalizers
    - codebasebranches
    - codebasebranches/status
    - codebasebranches/finalizers
    - codebaseimagestreams
    - codebaseimagestreams/status
    - codebaseimagestreams/finalizers
    - configmaps
    - quicklinks
    - jiraservers
    - jiraservers/finalizers
    - jiraservers/status
    - jirafixversions
    - jirafixversions/status
    - jiraissuemetadatas
    - jiraissuemetadatas/finalizers
    - jiraissuemetadatas/status
    - cdstagedeployments
    - cdstagedeployments/finalizers
    - cdstagedeployments/status
    - stages
    - stages/finalizers
    - stages/status
    - cdpipelines
  verbs:
    - '*'
- apiGroups:
    - coordination.k8s.io
  resources:
    - leases
  verbs:
    - get
    - list
    - watch
    - create
    - update
    - patch
    - delete
- apiGroups:
    - networking.k8s.io
  resources:
    - ingresses
  verbs:
    - get
    - list
    - watch
    - create
- apiGroups:
    - ""
  resources:
    - events
  verbs:
    - create
    - patch
- apiGroups:
    - ''
  verbs:
    - get
    - watch
    - list
    - patch
    - update
    - create
  resources:
    - secrets
- apiGroups:
    - tekton.dev
  resources:
    - pipelineruns
  verbs:
    - create
    - get
    - list
    - patch
    - update
    - watch
- apiGroups:
    - triggers.tekton.dev
  resources:
    - triggertemplates
  verbs:
    - get
    - list
    - watch
{{ end }}
