-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate labels from Pipeline/Task to PipelineRun/TaskRun
With this change, labels are propagated from Pipeline and Task to PipelineRun and TaskRun, respectively, giving us full label propagation from Pipeline to PipelineRun to TaskRun to Pod and Task to TaskRun to Pod. This commit also adds a label whose key is pipeline.knative.dev/task to all TaskRuns that refer to a Task with a TaskRef (the label is not added to TaskRuns using an embedded TaskSpec) that contains the name of the Task. Documentation related to labels was moved to labels.md in order to avoid duplicating similar content across four other pages. Fixes #501
- Loading branch information
1 parent
d0e426a
commit 69ade03
Showing
11 changed files
with
281 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Labels | ||
|
||
In order to make it easier to identify objects that are all part of the same | ||
conceptual pipeline, custom [labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/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. | ||
|
||
--- | ||
|
||
- [Propagation Details](#propagation-details) | ||
- [Automatically Added Labels](#automatically-added-labels) | ||
- [Examples](#examples) | ||
|
||
--- | ||
|
||
## Propagation Details | ||
|
||
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`](taskruns.md#specifying-a-task) | ||
section of the `TaskRun` documentation) to the corresponding `TaskRun` and then | ||
to the `Pod`. | ||
|
||
## Automatically Added Labels | ||
|
||
The following labels are added to resources automatically: | ||
|
||
- `tekton.dev/pipeline` is added to `PipelineRuns` (and propagated to | ||
`TaskRuns` and `Pods`), and contains the name of the `Pipeline` that the | ||
`PipelineRun` references. | ||
- `tekton.dev/pipelineRun` is added to `TaskRuns` (and propagated to `TaskRuns` | ||
and `Pods`) that are created automatically during the execution of a | ||
`PipelineRun`, and contains the name of the `PipelineRun` that triggered the | ||
creation of the `TaskRun`. | ||
- `tekton.dev/task` is added to `TaskRuns` (and propagated to `Pods`) that | ||
reference an existing `Task` (see the [Specifying a `Task`](taskruns.md#specifying-a-task) | ||
section of the `TaskRun` documentation), and contains the name of the `Task` | ||
that the `TaskRun` references. | ||
- `tekton.dev/taskRun` is added to `Pods`, and contains the name of the | ||
`TaskRun` that created the `Pod`. | ||
|
||
## Examples | ||
|
||
- [Finding Pods for a Specific PipelineRun](#finding-pods-for-a-specific-pipelinerun) | ||
- [Finding TaskRuns for a Specific Task](#finding-taskruns-for-a-specific-task) | ||
|
||
### Finding Pods for a Specific PipelineRun | ||
|
||
To find all `Pods` created by a `PipelineRun` named test-pipelinerun, you | ||
could use the following command: | ||
|
||
```shell | ||
kubectl get pods --all-namespaces -l tekton.dev/pipelineRun=test-pipelinerun | ||
``` | ||
|
||
### Finding TaskRuns for a Specific Task | ||
|
||
To find all `TaskRuns` that reference a `Task` named test-task, you | ||
could use the following command: | ||
|
||
```shell | ||
kubectl get taskruns --all-namespaces -l tekton.dev/task=test-task | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.