Skip to content

Event listener image failed to start up correctly #1771

Closed
@winston0410

Description

Expected Behavior

I expect applying EventListener CR would start up a deployment correctly.

Actual Behavior

The event-listener failed to run, and have the following log:

2024/10/03 02:58:22 Error building kubeconfig: failed to create client config: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable

Steps to Reproduce the Problem

  1. Install Tekton using Operator

  2. Apply the following TektonConfig

---
apiVersion: operator.tekton.dev/v1alpha1
kind: TektonConfig
metadata:
  name: config
  namespace: tekton-operator
spec:
  targetNamespace: tekton-pipelines
  profile: all
  chain:
    disabled: true
  pipeline:
    options:
      deployments:
        tekton-events-controller:
          spec:
            template:
              spec:
                containers:
                  - name: tekton-events-controller
                    resources:
                      limits:
                        cpu: 25m
                        memory: 128Mi
                      requests:
                        cpu: 1m
                        memory: 32Mi
        tekton-pipelines-controller:
          spec:
            template:
              spec:
                containers:
                  - name: tekton-pipelines-controller
                    resources:
                      limits:
                        cpu: 25m
                        memory: 128Mi
                      requests:
                        cpu: 1m
                        memory: 32Mi
        tekton-pipelines-remote-resolvers:
          spec:
            template:
              spec:
                containers:
                  - name: controller
                    resources:
                      limits:
                        cpu: 100m
                        memory: 256Mi
                      requests:
                        cpu: 10m
                        memory: 32Mi
        tekton-pipelines-webhook:
          spec:
            template:
              spec:
                containers:
                  - name: webhook
                    resources:
                      limits:
                        cpu: 100m
                        memory: 500Mi
                      requests:
                        cpu: 5m
                        memory: 100Mi
  trigger:
    options:
      deployments:
        tekton-operator-proxy-webhook:
          spec:
            template:
              spec:
                containers:
                  - name: proxy
                    resources:
                      limits:
                        cpu: 50m
                        memory: 256Mi
                      requests:
                        cpu: 10m
                        memory: 100Mi
        tekton-triggers-controller:
          spec:
            template:
              spec:
                containers:
                  - name: tekton-triggers-controller
                    resources:
                      limits:
                        cpu: 25m
                        memory: 128Mi
                      requests:
                        cpu: 1m
                        memory: 24Mi
        tekton-triggers-core-interceptors:
          spec:
            template:
              spec:
                containers:
                  - name: tekton-triggers-core-interceptors
                    resources:
                      limits:
                        cpu: 25m
                        memory: 128Mi
                      requests:
                        cpu: 1m
                        memory: 16Mi
        tekton-triggers-webhook:
          spec:
            template:
              spec:
                containers:
                  - name: webhook
                    resources:
                      limits:
                        cpu: 25m
                        memory: 128Mi
                      requests:
                        cpu: 1m
                        memory: 24Mi
  pruner:
    disabled: false
    schedule: "0 * * * *"
    resources:
      - taskrun
      - pipelinerun
    keep-since: 45 # in mins
  dashboard:
    readonly: false
    options:
      deployments:
        tekton-dashboard:
          spec:
            template:
              spec:
                containers:
                  - name: tekton-dashboard
                    resources:
                      limits:
                        cpu: 25m
                        memory: 128Mi
                      requests:
                        cpu: 1m
                        memory: 16Mi
  1. Apply the following manifest for the event listener
---
apiVersion: v1
kind: Namespace
metadata:
  name: example-github
  labels:
    pod-security.kubernetes.io/enforce: baseline
---
apiVersion: v1
automountServiceAccountToken: false
kind: ServiceAccount
metadata:
  name: github-pipeline
  namespace: example-github   
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: triggers-example-eventlistener-binding
subjects:
- kind: ServiceAccount
  name: github-pipeline
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: tekton-triggers-eventlistener-roles
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: triggers-example-eventlistener-clusterbinding
subjects:
- kind: ServiceAccount
  name: github-pipeline
  namespace: example-github
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: tekton-triggers-eventlistener-clusterroles
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: echo-repo-url
  namespace: example-github
spec:
  params:
  - name: git-repo-url
    type: string
  steps:
    - name: echo-repo-url
      image: busybox
      script: |
        #!/bin/bash
        echo "Git repository pushed $(params.git-repo-url)!" 
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: github-push-pipeline
  namespace: example-github
spec:
  params:
  - name: git-repo-url
    type: string
  tasks:
    - name: echo-repo-url
      taskRef:
        name: echo-repo-url
      params:
        - name: git-repo-url
          value: $(params.git-repo-url)
# REF https://docs.github.com/en/webhooks/webhook-events-and-payloads#push
---
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
  name: github-webhook-push-binding
  namespace: example-github
spec:
  params:
    - name: git-repo-url
      value: $(body.repository.clone_url)
    - name: git-head-commit-hash
      value: $(body.head_commit.id)
    - name: git-head-commit-message
      value: $(body.head_commit.message)
    - name: git-head-commit-url
      value: $(body.head_commit.url)
---
apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
metadata:
  name: github-push-pipeline-template
  namespace: example-github
spec:
  params:
    - name: git-repo-url
      description: The url for cloning git repository
    - name: git-head-commit-hash
      description: sha hash for the commit trigger the branch
  resourcetemplates:
    - apiVersion: tekton.dev/v1beta1
      kind: PipelineRun
      metadata:
        generateName: github-pipeline-run-
      spec:
        pipelineRef:
          name: github-push-pipeline
        params:
          - name: git-repo-url
            value: $(tt.params.git-repo-url)
          - name: git-head-commit-hash
            value: $(tt.params.git-head-commit-hash)
        workspaces:
          - name: git-source
            emptyDir: 
              sizeLimit: 256Mi
        serviceAccountName: github-pipeline
---
apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
metadata:
  name: github-listener
  namespace: example-github
spec:
  triggers:
    - name: github-listener
      interceptors:
        - ref:
            name: "github"
            kind: ClusterInterceptor
            apiVersion: triggers.tekton.dev
          params:
            - name: "secretRef"
              value:
                secretName: github-webhook-secret
                secretKey: secretToken
            - name: "eventTypes"
              value: ["push"]
      bindings:
        - ref: github-webhook-push-binding
      template:
        ref: github-push-pipeline-template
  resources:
    kubernetesResource:
      spec:
        template:
          spec:
            serviceAccountName: github-pipeline
            containers:
              - resources:
                  requests:
                    memory: 64Mi
                    cpu: 2m
                  limits:
                    memory: 128Mi
                    cpu: 25m

Additional Info

  • Kubernetes version:

    Output of kubectl version:

Client Version: v1.30.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.1


- Tekton Pipeline version:

v0.61.1

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions