{{- if eq .Values.global.platform "openshift" -}}
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:
    - cdpipelines
    - cdstagedeployments
    - cdstagedeployments/finalizers
    - cdstagedeployments/status
    - codebasebranches
    - codebasebranches/finalizers
    - codebasebranches/status
    - codebaseimagestreams
    - codebaseimagestreams/finalizers
    - codebaseimagestreams/status
    - codebases
    - codebases/finalizers
    - codebases/status
    - configmaps
    - gitservers
    - gitservers/finalizers
    - gitservers/status
    - jirafixversions
    - jirafixversions/status
    - jiraissuemetadatas
    - jiraissuemetadatas/finalizers
    - jiraissuemetadatas/status
    - jiraservers
    - jiraservers/finalizers
    - jiraservers/status
    - stages
    - stages/finalizers
    - stages/status
  verbs:
    - '*'
- apiGroups:
    - coordination.k8s.io
  resources:
    - leases
  verbs:
    - create
    - delete
    - get
    - list
    - patch
    - update
    - watch
- apiGroups:
    - route.openshift.io
  resources:
    - routes
  verbs:
    - get
    - list
    - watch
    - create
- apiGroups:
    - ""
  resources:
    - events
  verbs:
    - create
    - patch
- apiGroups:
    - tekton.dev
  resources:
    - pipelineruns
  verbs:
    - create
    - get
    - list
    - patch
    - update
    - watch
- apiGroups:
    - triggers.tekton.dev
  resources:
    - triggertemplates
  verbs:
    - get
    - list
    - watch
{{ end }}
