{{- if eq .Values.interceptor.enabled true }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: tekton-triggers-edp-interceptor
  labels:
    {{- include "edp-tekton-interceptor.labels" . | nindent 4 }}
rules:
  - verbs:
      - get
      - list
      - watch
      - update
    apiGroups:
      - triggers.tekton.dev
    resources:
      - interceptors

  - verbs:
      - get
      - list
      - watch
      - update
      - create
    apiGroups:
      - ''
    resources:
      - secrets
    resourceNames:
      - tekton-edp-interceptor-certs

  - verbs:
      - get
    apiGroups:
      - ''
    resources:
      - secrets

  - verbs:
      - get
      - list
      - watch
    apiGroups:
      - v2.edp.epam.com
    resources:
      - codebases
      - codebases/status
      - codebases/finalizers

  - verbs:
      - get
      - list
      - watch
    apiGroups:
      - v2.edp.epam.com
    resources:
      - codebasebranches
      - codebasebranches/status
      - codebasebranches/finalizers

  - verbs:
      - get
      - list
      - watch
    apiGroups:
      - v2.edp.epam.com
    resources:
      - gitservers
      - gitservers/status
      - gitservers/finalizers
{{- end }}
