$ show tektoncd/pipeline
Tekton Pipelines is a Kubernetes-native CI/CD engine that defines and reconciles custom resources (Task, Pipeline, TaskRun, PipelineRun, StepAction, ResolutionRequest, etc.) to execute containerized workflows. The architecture follows the Kubernetes operator pattern using Knative's controller framework: admission webhooks for validation/defaulting, reconcilers that manage the lifecycle of each resource type, and a sidecar entrypoint binary for step execution. Key subsystems include a pluggable remote resolution framework (git, OCI bundles, HTTP, cluster, hub), CloudEvents-based notifications, SPIRE-based workload identity and provenance, and a DAG scheduler for pipeline task ordering. External dependencies include Kubernetes client-go, Knative/pkg, OpenTelemetry, CloudEvents SDK, sigstore, and various cloud SDKs. The codebase is well-structured with extensive unit and e2e tests, but carries some duplication between legacy and modern resolution packages.
The LLM identified 4 files worth highlighting for reuse:
Implements a directed acyclic graph (DAG) for pipeline task ordering. Given a set of tasks with dependencies (runAfter, from, results), it builds a graph, detects cycles, and produces a topological execution order. The implementation is self-contained, uses generic interfaces, and can be extracted for any workflow scheduling problem.
Provides a variable substitution engine for Tekton's parameter and result references (e.g., $(params.foo), $(results.bar.baz)). Supports array indexing, object fields, and nested substitutions. The core functions ApplyReplacements and ApplyArrayReplacements are isolated, well-tested, and reusable in any system needing Kubernetes-style variable interpolation.
A configurable LRU cache with TTL and max-size limits, using singleflight to deduplicate concurrent resolution requests. It integrates with ConfigMap-driven configuration and supports deterministic key generation via parameter hashing. This pattern is reusable for any remote resource caching scenario (e.g., fetching external configs, OCI images).
Strips managedFields and last-applied-configuration annotations from Kubernetes informer cache objects to reduce memory consumption. Carefully preserves load-bearing fields, tombstones, and handles edge cases like nil objects. Demonstrates deep understanding of Kubernetes informer internals and is reusable for any controller needing to reduce cache memory.