I have twenty different repositories for the twenty separate services to be deployed on an OKD cluster. I want to create separate eventListener for each repository/service. The first eventListener and all it's related components (Deployment, Pod, Service) are successfully created and the eventListener status becomes active, but on deploying more eventListener, eventListener is created but none of the related resources like (Deployment, Pod, and Service) are created and the status is Empty. Here I am sharing the eventListener YAML file.
---
apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
metadata:
name: el-name
namespace: namespace-name
spec:
serviceAccountName: pipeline
triggers:
- triggerRef: trigger-reference-name
I fixed it by updating my Trigger code, to filter the repository names, so that just the pushed repository can start the pipeline.
---
apiVersion: triggers.tekton.dev/v1beta1
kind: Trigger
metadata:
name: trigger-name
namespace: namespace-name
spec:
nodeSelector:
node-role.kubernetes.io/worker-serial=worker2
spec:
serviceAccountName: pipeline
interceptors:
- ref:
name: "cel"
params:
- name: "overlays"
value:
- key: X-Hub-Signature
expression: "1234567"
- name: "filter"
value: "header.match('X-Event-Key', 'repo:push') && body.push.changes[0].new.name=='dev'"
- name: "filter"
value: "header.match('X-Event-Key', 'repo:push') && body.repository.full_name=='org-name/service-name'"
bindings:
- ref: binding-sample
template:
ref: tt-sample
Thanks @SYN for some useful hints.