You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Support for managedBy field in TaskRun and PipelineRun
Added a "managedBy" field to delegate responsibility of controlling
the lifecycle of PipelineRuns/TaskRuns.
The semantics of the field:
Whenever the value is set, and it does not point to the built-in
controller, then we skip the reconciliation.
* The field is immutable
* The field is not defaulted
Assisted By: Gemini
-[Cancelling a <code>PipelineRun</code>](#cancelling-a-pipelinerun)
39
40
-[Gracefully cancelling a <code>PipelineRun</code>](#gracefully-cancelling-a-pipelinerun)
40
41
-[Gracefully stopping a <code>PipelineRun</code>](#gracefully-stopping-a-pipelinerun)
@@ -80,6 +81,7 @@ A `PipelineRun` definition supports the following fields:
80
81
-[`timeouts`](#configuring-a-failure-timeout) - Specifies the timeout before the `PipelineRun` fails. `timeouts` allows more granular timeout configuration, at the pipeline, tasks, and finally levels
81
82
-[`podTemplate`](#specifying-a-pod-template) - Specifies a [`Pod` template](./podtemplates.md) to use as the basis for the configuration of the `Pod` that executes each `Task`.
82
83
-[`workspaces`](#specifying-workspaces) - Specifies a set of workspace bindings which must match the names of workspaces declared in the pipeline being used.
84
+
-[`managedBy`](#delegating-reconciliation) - Specifies the controller responsible for managing this PipelineRun's lifecycle.
@@ -1642,6 +1644,39 @@ NAME STARTED DURATION STATUS
1642
1644
pipelinerun-with-params 5 seconds ago 0s Failed(ParameterMissing)
1643
1645
```
1644
1646
1647
+
## Delegating reconciliation
1648
+
1649
+
The `managedBy` field allows you to delegate the responsibility of managing a `PipelineRun`'s lifecycle to an external controller. When this field is set to a value other than `"tekton.dev/pipeline"`, the Tekton Pipeline controller will ignore the `PipelineRun`, allowing your external controller to take full control. This delegation enables several advanced use cases, such as implementing custom pipeline execution logic, integrating with external management tools, using advanced scheduling algorithms, or coordinating PipelineRuns across multiple clusters (like using [MultiKueue](https://kueue.sigs.k8s.io/docs/concepts/multikueue/)).
1650
+
1651
+
### Example
1652
+
1653
+
```yaml
1654
+
apiVersion: tekton.dev/v1
1655
+
kind: PipelineRun
1656
+
metadata:
1657
+
name: externally-managed-pipeline
1658
+
spec:
1659
+
pipelineRef:
1660
+
name: my-pipeline
1661
+
managedBy: "my-custom-controller"
1662
+
```
1663
+
1664
+
### Behavior
1665
+
1666
+
- **When `managedBy` is empty**: The Tekton Pipeline controller manages the PipelineRun normally
1667
+
- **When `managedBy` is set to `"tekton.dev/pipeline"`**: The Tekton Pipeline controller manages the PipelineRun normally
1668
+
- **When `managedBy` is set to any other value**: The Tekton Pipeline controller ignores the PipelineRun completely
1669
+
- **Immutability**: The `managedBy` field is immutable and cannot be changed after creation
1670
+
1671
+
### External controller responsibilities
1672
+
1673
+
When you set `managedBy` to a custom value, your external controller is responsible for:
1674
+
1675
+
- Creating and managing TaskRuns
1676
+
- Updating PipelineRun status
1677
+
- Handling timeouts and cancellations
1678
+
- Managing retries and error handling
1679
+
1645
1680
## Cancelling a `PipelineRun`
1646
1681
1647
1682
To cancel a `PipelineRun` that's currently executing, update its definition
@@ -1112,6 +1114,40 @@ this is available as a [TaskRun example](../examples/v1/taskruns/run-steps-as-no
1112
1114
1113
1115
More information about Pod and Container Security Contexts can be found via the [Kubernetes website](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod).
1114
1116
1117
+
## Delegating reconciliation
1118
+
1119
+
The `managedBy` field allows you to delegate the responsibility of managing a `TaskRun`'s lifecycle to an external controller. When this field is set to a value other than `"tekton.dev/pipeline"`, the Tekton Pipeline controller will ignore the `TaskRun`, allowing your external controller to take full control. This delegation enables several advanced use cases, such as implementing custom pipeline execution logic, integrating with external management tools, using advanced scheduling algorithms, or coordinating PipelineRuns across multiple clusters (like using [MultiKueue](https://kueue.sigs.k8s.io/docs/concepts/multikueue/)).
1120
+
1121
+
### Example
1122
+
1123
+
```yaml
1124
+
apiVersion: tekton.dev/v1
1125
+
kind: TaskRun
1126
+
metadata:
1127
+
name: externally-managed-task
1128
+
spec:
1129
+
taskRef:
1130
+
name: my-task
1131
+
managedBy: "my-custom-controller"
1132
+
```
1133
+
1134
+
### Behavior
1135
+
1136
+
- **When `managedBy` is empty**: The Tekton Pipeline controller manages the TaskRun normally
1137
+
- **When `managedBy` is set to `"tekton.dev/pipeline"`**: The Tekton Pipeline controller manages the TaskRun normally
1138
+
- **When `managedBy` is set to any other value**: The Tekton Pipeline controller ignores the TaskRun completely
1139
+
- **Immutability**: The `managedBy` field is immutable and cannot be changed after creation
1140
+
1141
+
### External controller responsibilities
1142
+
1143
+
When you set `managedBy` to a custom value, your external controller is responsible for:
1144
+
1145
+
- Creating and managing Pods
1146
+
- Updating TaskRun status
1147
+
- Handling timeouts and cancellations
1148
+
- Managing retries and error handling
1149
+
- Processing step results and artifacts
1150
+
1115
1151
---
1116
1152
1117
1153
Except as otherwise noted, the content of this page is licensed under the
Copy file name to clipboardExpand all lines: pkg/apis/pipeline/v1/swagger.json
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -661,6 +661,10 @@
661
661
"description": "PipelineRunSpec defines the desired state of PipelineRun",
662
662
"type": "object",
663
663
"properties": {
664
+
"managedBy": {
665
+
"description": "ManagedBy indicates which controller is responsible for reconciling this resource. If unset or set to \"tekton.dev/pipeline\", the default Tekton controller will manage this resource. This field is immutable.",
666
+
"type": "string"
667
+
},
664
668
"params": {
665
669
"description": "Params is a list of parameter names and values.",
666
670
"type": "array",
@@ -2049,6 +2053,10 @@
2049
2053
"debug": {
2050
2054
"$ref": "#/definitions/v1.TaskRunDebug"
2051
2055
},
2056
+
"managedBy": {
2057
+
"description": "ManagedBy indicates which controller is responsible for reconciling this resource. If unset or set to \"tekton.dev/pipeline\", the default Tekton controller will manage this resource. This field is immutable.",
0 commit comments