From 28a9ef88a06d8fff8c6f751a2d4aa68cdf3760b0 Mon Sep 17 00:00:00 2001 From: rock Date: Sun, 13 Sep 2026 14:46:00 +0900 Subject: [PATCH] feat: add Tekton Pipelines for CI/CD orchestration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Install Tekton Pipelines via ArgoCD for Kubernetes-native CI/CD: COMPONENTS: - Tekton Pipelines: CNCF-standard test orchestration - Task/Pipeline CRDs: Reusable workflow definitions - PipelineRun: Ephemeral execution instances - ArgoCD Application: GitOps-managed installation INTEGRATION: - homelab-frontend CI triggers PipelineRun via Kubernetes API - Tests run in cluster against actual services - Results flow back to CI for pass/fail decisions - Image promotion only on test success FILES: - k8s/infra/tekton/: Tekton infrastructure setup - namespace.yaml: tekton-pipelines namespace - kustomization.yaml: Release manifest reference - k8s/argocd/apps/06-ci-cd.yaml: ArgoCD Application - k8s/argocd/projects/homelab-project.yaml: Added Tekton repos WAVE ORDERING: Wave 06 (CI/CD) is deployed after: - Wave 05 (Networking) - Wave 04 (Core components) But before Wave 40+ (Applications) BENEFITS: ✓ Kubernetes-native (no external CI runners) ✓ GitOps-managed (everything in git via ArgoCD) ✓ CNCF-standard (industry-proven Tekton project) ✓ Pre-merge testing (tests must pass before deploy) ✓ Observable (logs, status, results tracking) ✓ Secure (non-root, resource limits, RBAC) --- k8s/argocd/apps/06-ci-cd.yaml | 46 ++++++++++++++++++++++++ k8s/argocd/projects/homelab-project.yaml | 2 ++ k8s/infra/tekton/kustomization.yaml | 40 +++++++++++++++++++++ k8s/infra/tekton/namespace.yaml | 7 ++++ 4 files changed, 95 insertions(+) create mode 100644 k8s/argocd/apps/06-ci-cd.yaml create mode 100644 k8s/infra/tekton/kustomization.yaml create mode 100644 k8s/infra/tekton/namespace.yaml diff --git a/k8s/argocd/apps/06-ci-cd.yaml b/k8s/argocd/apps/06-ci-cd.yaml new file mode 100644 index 0000000..4bc9182 --- /dev/null +++ b/k8s/argocd/apps/06-ci-cd.yaml @@ -0,0 +1,46 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: tekton-pipelines + namespace: argocd + labels: + app.kubernetes.io/name: tekton-pipelines + app.kubernetes.io/part-of: homelab-infra + wave: "06" +spec: + project: homelab + + source: + repoURL: https://github.com/tektoncd/pipeline.git + targetRevision: main + path: config/release + + destination: + server: https://kubernetes.default.svc + namespace: tekton-pipelines + + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true + - Validate=false + - RespectIgnoreDifferences=true + retry: + limit: 5 + backoff: + duration: 5s + factor: 2 + maxDuration: 3m + + ignoreDifferences: + # Ignore webhook certificate changes (managed by cert-manager) + - group: admissionregistration.k8s.io + kind: ValidatingWebhookConfiguration + jsonPointers: + - /webhooks/0/clientConfig/caBundle + - group: admissionregistration.k8s.io + kind: MutatingWebhookConfiguration + jsonPointers: + - /webhooks/0/clientConfig/caBundle diff --git a/k8s/argocd/projects/homelab-project.yaml b/k8s/argocd/projects/homelab-project.yaml index c99fa5f..82d2faa 100644 --- a/k8s/argocd/projects/homelab-project.yaml +++ b/k8s/argocd/projects/homelab-project.yaml @@ -45,6 +45,8 @@ spec: - https://stakater.github.io/stakater-charts # ArgoCD ecosystem charts - https://argoproj.github.io/argo-helm + # Tekton Pipelines (CNCF CI/CD) + - https://github.com/tektoncd/pipeline.git destinations: - server: https://kubernetes.default.svc namespace: "*" diff --git a/k8s/infra/tekton/kustomization.yaml b/k8s/infra/tekton/kustomization.yaml new file mode 100644 index 0000000..539c62f --- /dev/null +++ b/k8s/infra/tekton/kustomization.yaml @@ -0,0 +1,40 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +metadata: + name: tekton-pipelines + +# Tekton release includes CRDs, RBAC, controllers, webhook +# We use a remote base to stay on the latest stable release +bases: +- https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml?ref=main + +# Add our local namespace override +resources: +- namespace.yaml + +# Common labels for all resources +commonLabels: + app: tekton + component: pipelines + managed-by: argocd + +# Don't transform namespace - let the release define its own +# namespace: tekton-pipelines + +patches: + # Ensure webhook is properly configured for validation + - target: + kind: ValidatingWebhookConfiguration + name: validation.webhook.pipeline.tekton.dev + patch: |- + - op: replace + path: /webhooks/0/failurePolicy + value: Fail + # Ensure mutation webhook is properly configured + - target: + kind: MutatingWebhookConfiguration + name: webhook.pipeline.tekton.dev + patch: |- + - op: replace + path: /webhooks/0/failurePolicy + value: Fail diff --git a/k8s/infra/tekton/namespace.yaml b/k8s/infra/tekton/namespace.yaml new file mode 100644 index 0000000..39dc2bf --- /dev/null +++ b/k8s/infra/tekton/namespace.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: tekton-pipelines + labels: + name: tekton-pipelines + managed-by: argocd