Tekton Concepts
Internal
Overview
Tekton is a cloud-native solution for building CI/CD pipelines. Tekton installs and runs as an extension on your Kubernetes cluster and uses the well-established Kubernetes resource model. Tekton workloads execute inside Kubernetes containers. It has several components: Tekton Pipelines, Tekton CLI and Tekton Catalog. Tekton is part of the CD Foundation, a Linux Foundation project. It is implemented as a set of Kubernetes Custom Resources. Once deployed, Tekton can be accessed via Tekton CLI commands or API calls.
Task
ClusterTask
A task is available in a certain namespace, while a ClusterTask is available across the entire cluster. A ClusterTask behaves identically to a task. When declaring a ClusterTask in the pipeline definition, the kind
sub-field of the taskRef
should be explicitly set to ClusterTask
. If not specified, kind
defaults to Task
.
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
[...]
spec:
tasks:
- name: some-cluster-task
taskRef:
name: some-task
kind: ClusterTask
...
Custom Task
- https://tekton.dev/docs/pipelines/pipelines/#using-custom-tasks
- https://github.com/tektoncd/community/blob/main/teps/0002-custom-tasks.md
Step
TaskRun
Pipeline
PipelineRun
Workspaces
Trigger
Implemented as part of the Tekton Triggers component.
Resource
- Understand the relationship between Resources and PipelineResources.
- Understand transition from PipelineResources to Tasks, read https://tekton.dev/docs/pipelines/migrating-v1alpha1-to-v1beta1/#replacing-pipelineresources-with-tasks
- Parse https://tekton.dev/docs/pipelines/resources/ and map it on the new implementation.
Resources are used to share data between steps and tasks, and depending on which direction they are looked at, the can be input or output resources. Resources are connected to tasks and pipelines by taskRuns and pipelineRuns, respectively. A run must include the actual addresses of resources, such as the URLs of repositories, its task or pipeline needs.
Example of resources:
- git repository
- a pull request
- a container image
- a Kubernetes cluster
- storage: an object, a directory, etc.
- a CloudEvent
Input Resource
The input is defined relative to a step. Examples of input resources are: git repository.
Output Resource
The output is defined relative to a step. Examples of output resources: container image.
PipelineResource
Deprecated. Defines locations for inputs ingested and outputs produced by the steps in tasks. Also see Task Resources.
TO PROCESS:
Result
Tekton Results aims to help users logically group CI/CD workload history and separate out long term result storage away from the Pipeline controller.
TO PROCESS:
- Using Results in Pipelines: https://tekton.dev/docs/pipelines/pipelines/#using-results
- Consuming task execution results in finally: https://tekton.dev/docs/pipelines/pipelines/#consuming-task-execution-results-in-finally
Run
Instantiates a Custom Task for execution when specific inputs.
Building Block
Tekton documentation refers to "building blocks". Those are ...
LimitRange
TO PROCESS:
- https://tekton.dev/docs/pipelines/taskruns/#specifying-limitrange-values
- https://kubernetes.io/docs/concepts/policy/limit-range/
- https://tekton.dev/docs/pipelines/limitrange/
Events
TO PROCESS.
Bundles
Conditions
Conditions are deprecated, use when
expressions instead.
Parameters
Security
Tekton Runtime Model
Tekton Pipelines tracks the state of a pipeline using Kubernetes annotations, which are projected inside each step container in the form of files with the Kubernetes Downward API. The step container entrypoint binary watches these projected files and will only start the command the step is supposed to execute only if a specific annotation appears as file.
In addition, Tekton Pipelines schedules some containers to run automatically before and after the step containers to support built-in features such as the retrieval of input resources and the uploading the outputs to wherever they are supposed to go.
TO PROCESS: Labels and Annotations: https://tekton.dev/docs/pipelines/labels/
Tekton Components
Tekton Pipelines
Tekton Pipelines is the component that implements the core functionality of Tekton and sets the foundation for other components. It is implemented as a set of Kubernetes Custom Resources.
Tekton Pipeline Runtime
Tekton Pipelines Controller
Tekton Pipelines Webhook
Tekton Pipeline Operations
Tekton CLI
Tekton CLI provides the command interface called tkn
.
Tekton CLI Operations
Tekton API
Tekton APIs are currently available for Pipelines and Triggers allow you to programmatically interact with the Tekton components.
Tekton Catalog
Tekton Catalog is a repository of community-contributed Tekton building blocks.
Tekton Hub
Tekton Hub is a web GUI to access Tekton Catalog.
Tekton Triggers
Tekton Triggers provide triggers, which allow instantiating pipelines based on events (a PR merge, etc.)
Tekton Dashboard
Tekton Dashboard is the web GUI that displays information about pipeline execution.
Tekton Operator
Tekton Operator is the implementation of the Kubernetes Operator pattern that assists with the operation of the Tekton projects.
Programming Model
Process Task Authoring Recommendations: https://github.com/tektoncd/catalog/blob/main/recommendations.md
Variables
TO PROCESS:
- https://tekton.dev/docs/pipelines/variables/
- https://tekton.dev/docs/pipelines/tasks/#using-variable-substitution
- Variables available in a Task https://tekton.dev/docs/pipelines/variables/#variables-available-in-a-task
- Variables available in a Pipeline https://tekton.dev/docs/pipelines/variables/#variables-available-in-a-pipeline
- Fields that accept variable substitutions: https://tekton.dev/docs/pipelines/variables/#fields-that-accept-variable-substitutions
- Using variable substitution in pipelines: https://tekton.dev/docs/pipelines/pipelines/#using-variable-substitution
Code Examples
TO PROCESS:
- Code Examples: https://tekton.dev/docs/pipelines/tasks/#code-examples
- Code Examples: https://github.com/tektoncd/pipeline/tree/main/examples
- TaskRun code examples: https://tekton.dev/docs/pipelines/taskruns/#code-examples
- https://github.com/tektoncd/pipeline/blob/release-v0.35.x/examples/v1beta1/taskruns/run-steps-as-non-root.yaml
- Pipeline code examples: https://github.com/tektoncd/pipeline/tree/main/examples
Start the list here:
- How to do this
- How to do that