Skip to content

Commit

Permalink
fix(apps/prod/tekton): fix issue of event listener issue
Browse files Browse the repository at this point in the history
Also refactored the ingress to a special dir `ingress`.
Ref: https://fluxcd.io/flux/components/kustomize/kustomization/#post-build-variable-substitution

Signed-off-by: wuhuizuo <wuhuizuo@126.com>
  • Loading branch information
wuhuizuo committed Jul 21, 2023
1 parent 9d2c950 commit 57bdb3f
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 43 deletions.
5 changes: 0 additions & 5 deletions apps/prod/tekton/configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,3 @@ spec:
value:
scheduler.alpha.kubernetes.io/defaultTolerations: '[{"operator": "Equal", "effect": "NoSchedule", "key": "dedicated", "value": "test-infra"}]'
scheduler.alpha.kubernetes.io/node-selector: enable-ci=true
postBuild:
substituteFrom:
- kind: Secret
name: tekton-ingress # should manual created in namespace `apps`
optional: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- rbac.yaml
- event-listener.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,4 @@ roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: tekton-triggers-eventlistener-clusterroles # created by tekton operator
---
# custom rights
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: k8s-pod-full
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- delete
- list
- get
- watch
- create
- patch

---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: k8s-pod-full
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: k8s-pod-full
3 changes: 1 addition & 2 deletions apps/prod/tekton/configs/triggers/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ resources:
- bindings
- triggers
- rbac.yaml
- event-listener.yaml
- ingress-event-listener.yaml
- event-listeners
4 changes: 2 additions & 2 deletions apps/prod/tekton/configs/triggers/templates/public.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
description: The git repository full url
- name: git-revision
description: The git revision
default: main
default: main
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
Expand All @@ -18,7 +18,7 @@ spec:
"tekton.dev/git-status": "true"
"tekton.dev/status-context": "demo-pipeline1"
"tekton.dev/status-description": "demo pipeline forwarded by prow"
"tekton.dev/status-target-url": "https://dashboard.tekton.pingcap.net/#/namespaces/{{ .Namespace }}/pipelineruns/{{ .Name }}"
"tekton.dev/status-target-url": "https://do.pingcap.net/tekton/#/namespaces/{{ .Namespace }}/pipelineruns/{{ .Name }}"
"tekton.dev/git-repo": $(tt.params.git-url)
"tekton.dev/git-revision": $(tt.params.git-revision)
spec:
Expand Down
24 changes: 24 additions & 0 deletions apps/prod/tekton/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: tekton-ingress
namespace: apps
spec:
interval: 1m0s
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
path: ./apps/prod/tekton/ingress
dependsOn:
- name: tekton-setup
namespace: apps
- name: tekton-configs
namespace: apps
prune: true
postBuild:
substituteFrom:
- kind: Secret
name: tekton-ingress # should manual created in namespace `apps`
optional: true
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ spec:
name: tekton-dashboard
port:
name: http

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: trigger-groups-listener
namespace: ee-cd
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
Expand All @@ -12,7 +13,7 @@ spec:
http:
paths:
- pathType: Prefix
path: "(/|$)(.*)"
path: "${path_for_hook}(/|$)(.*)"
backend:
service:
name: el-trigger-groups-listener
Expand Down
5 changes: 5 additions & 0 deletions apps/prod/tekton/ingress/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ingress-dashboard.yaml
- ingress-event-listener.yaml
1 change: 1 addition & 0 deletions apps/prod/tekton/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ kind: Kustomization
resources:
- setup.yaml
- configs.yaml
- ingress.yaml
5 changes: 0 additions & 5 deletions apps/prod/tekton/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,4 @@ spec:
kind: Deployment
name: tekton-dashboard
namespace: tekton-pipelines
postBuild:
substituteFrom:
- kind: Secret
name: tekton-ingress # should manual created in namespace `apps`
optional: true
timeout: 5m0s
1 change: 0 additions & 1 deletion apps/prod/tekton/setup/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ resources:
# gcr.io/tekton-releases/dogfooding/tkn
- operator-release.yaml
- operator-config.yaml
- ingress-dashboard.yaml

0 comments on commit 57bdb3f

Please sign in to comment.