In order to make it easier to identify objects that are all part of the same conceptual pipeline, custom labels set on resources used by Tekton Pipelines are propagated from more general to more specific resources, and a few labels are automatically added to make it easier to identify relationships between those resources.
For Pipelines
executed using a PipelineRun
, labels are propagated
automatically from Pipelines
to PipelineRuns
to TaskRuns
and then to
Pods
. Additionally, labels from the Tasks
referenced by TaskRuns
are
propagated to the corresponding TaskRuns
and then to Pods
.
For TaskRuns
executed directly, not as part of a Pipeline
, labels are
propagated from the referenced Task
(if one exists, see the
Specifying a Task
section of the TaskRun
documentation) to the corresponding TaskRun
and then to the Pod
.
For Conditions
, labels are propagated automatically to the corresponding TaskRuns
and then to Pods
.
The following labels are added to resources automatically:
tekton.dev/pipeline
is added toPipelineRuns
(and propagated toTaskRuns
andPods
), and contains the name of thePipeline
that thePipelineRun
references.tekton.dev/pipelineRun
is added toTaskRuns
(and propagated toTaskRuns
andPods
) that are created automatically during the execution of aPipelineRun
, and contains the name of thePipelineRun
that triggered the creation of theTaskRun
.tekton.dev/task
is added toTaskRuns
(and propagated toPods
) that reference an existingTask
(see the Specifying aTask
section of theTaskRun
documentation), and contains the name of theTask
that theTaskRun
references.tekton.dev/clusterTask
is added toTaskRuns
(and propagated toPods
) that reference an existingClusterTask
and contains the name of theClusterTask
that theTaskRun
references. For backwards compatibility,TaskRuns
that reference aClusterTask
will also receivetekton.dev/task
.tekton.dev/taskRun
is added toPods
, and contains the name of theTaskRun
that created thePod
.app.kubernetes.io/instance
andapp.kubernetes.io/component
is added to Affinity AssistantStatefulSets
andPods
. These are used for Pod Affinity for TaskRuns.
To find all Pods
created by a PipelineRun
named test-pipelinerun, you could
use the following command:
kubectl get pods --all-namespaces -l tekton.dev/pipelineRun=test-pipelinerun
To find all TaskRuns
that reference a Task
named test-task, you could use
the following command:
kubectl get taskruns --all-namespaces -l tekton.dev/task=test-task
To find all TaskRuns
that reference a ClusterTask
named test-clustertask, you could use
the following command:
kubectl get taskruns --all-namespaces -l tekton.dev/clusterTask=test-clustertask