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
Support Task-level Resources Requirements on TaskRun: Part #1
Required fields and related webhook validations are added to support
a user to configure compute resources for TaskRun which will significantly
reduce the over-asked resources amount configured by the Step-level.
(This feature is under development and not functional yet. Stay tuned!)
46
49
47
50
Tekton allows users to specify resource requirements of [`Steps`](./tasks.md#defining-steps),
48
51
which run sequentially. However, the pod's effective resource requirements are still the
@@ -52,6 +55,86 @@ requirements for `Step` containers, they must be treated as if they are running
52
55
Tekton adjusts `Step` resource requirements to comply with [LimitRanges](#limitrange-support).
53
56
[ResourceQuotas](#resourcequota-support) are not currently supported.
54
57
58
+
Instead of specifying resource requirements on each `Step`, users can choose to specify resource requirements at the Task-level. If users specify a Task-level resource request, it will ensure that the kubelet reserves only that amount of resources to execute the `Task`'s `Steps`.
59
+
If users specify a Task-level resource limit, no `Step` may use more than that amount of resources.
60
+
61
+
Each of these details is explained in more depth below.
62
+
63
+
Some points to note:
64
+
65
+
- Task-level resource requests and limits do not apply to sidecars which can be configured separately.
66
+
- Users may not configure the Task-level and Step-level resource requirements (requests/limits) simultaneously.
67
+
68
+
### Configure Task-level Compute Resources
69
+
70
+
Task-level resource requirements can be configured in `TaskRun.ComputeResources`, or `PipelineRun.TaskRunSpecs.ComputeResources`.
71
+
72
+
e.g.
73
+
74
+
```yaml
75
+
apiVersion: tekton.dev/v1beta1
76
+
kind: TaskRun
77
+
metadata:
78
+
name: foo
79
+
spec:
80
+
computeResources:
81
+
requests:
82
+
cpu: 1
83
+
limits:
84
+
cpu: 2
85
+
```
86
+
87
+
The following TaskRun will be rejected, because it configures both step-level and task-level compute resource requirements:
88
+
89
+
```yaml
90
+
kind: TaskRun
91
+
spec:
92
+
stepOverrides:
93
+
- name: foo
94
+
resources:
95
+
requests:
96
+
cpu: 1
97
+
computeResources:
98
+
requests:
99
+
cpu: 2
100
+
```
101
+
102
+
```yaml
103
+
kind: PipelineRun
104
+
spec:
105
+
taskRunSpecs:
106
+
- pipelineTaskName: foo
107
+
stepOverrides:
108
+
- name: foo
109
+
resources:
110
+
requests:
111
+
cpu: 1
112
+
computeResources:
113
+
requests:
114
+
cpu: 2
115
+
```
116
+
117
+
### Configure Resource Requirements with Sidecar
118
+
119
+
Users can specify compute resources separately for a sidecar while configuring task-level resource requirements on TaskRun.
120
+
121
+
e.g.
122
+
123
+
```yaml
124
+
kind: TaskRun
125
+
spec:
126
+
sidecarOverrides:
127
+
- name: sidecar
128
+
resources:
129
+
requests:
130
+
cpu: 750m
131
+
limits:
132
+
cpu: 1
133
+
computeResources:
134
+
requests:
135
+
cpu: 2
136
+
```
137
+
55
138
## LimitRange Support
56
139
57
140
Kubernetes allows users to configure [LimitRanges]((https://kubernetes.io/docs/concepts/policy/limit-range/)),
(This feature is under development and not functional yet. Stay tuned!)
268
+
269
+
Task-level compute resources can be configured in `PipelineRun.TaskRunSpecs.ComputeResources` or `TaskRun.ComputeResources`.
270
+
271
+
e.g.
272
+
273
+
```yaml
274
+
apiVersion: tekton.dev/v1beta1
275
+
kind: Pipeline
276
+
metadata:
277
+
name: pipeline
278
+
spec:
279
+
tasks:
280
+
- name: task
281
+
---
282
+
apiVersion: tekton.dev/v1beta1
283
+
kind: PipelineRun
284
+
metadata:
285
+
name: pipelinerun
286
+
spec:
287
+
pipelineRef:
288
+
name: pipeline
289
+
taskRunSpecs:
290
+
- pipelineTaskName: task
291
+
computeResources:
292
+
requests:
293
+
cpu: 2
294
+
```
295
+
296
+
Further details and examples could be found in [Compute Resources in Tekton](https://github.com/tektoncd/pipeline/blob/main/docs/compute-resources.md).
297
+
263
298
### Specifying `Parameters`
264
299
265
300
(See also [Specifying Parameters in Tasks](tasks.md#specifying-parameters))
(This feature is under development and not functional yet. Stay tuned!)
331
+
332
+
Task-level compute resources can be configured in `TaskRun.ComputeResources`, or `PipelineRun.TaskRunSpecs.ComputeResources`.
333
+
334
+
e.g.
335
+
336
+
```yaml
337
+
apiVersion: tekton.dev/v1beta1
338
+
kind: Task
339
+
metadata:
340
+
name: task
341
+
spec:
342
+
steps:
343
+
- name: foo
344
+
---
345
+
apiVersion: tekton.dev/v1beta1
346
+
kind: TaskRun
347
+
metadata:
348
+
name: taskrun
349
+
spec:
350
+
taskRef:
351
+
name: task
352
+
computeResources:
353
+
requests:
354
+
cpu: 1
355
+
limits:
356
+
cpu: 2
357
+
```
358
+
359
+
Further details and examples could be found in [Compute Resources in Tekton](https://github.com/tektoncd/pipeline/blob/main/docs/compute-resources.md).
360
+
326
361
### Specifying a `Pod` template
327
362
328
363
You can specify a [`Pod` template](podtemplates.md) configuration that will serve as the configuration starting
0 commit comments