Bug 1970493 - stepTemplate limits and requests are not applied in init-container for Tekton clusterTask
Summary: stepTemplate limits and requests are not applied in init-container for Tekton...
Keywords:
Status: ASSIGNED
Alias: None
Product: Red Hat OpenShift Pipelines
Classification: Red Hat
Component: pipelines
Version: 1.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 1.6
Assignee: Vincent Demeester
QA Contact: Ruchir Garg
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-10 14:59 UTC by Gabriel Meghnagi
Modified: 2023-07-21 23:14 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Gabriel Meghnagi 2021-06-10 14:59:48 UTC
Description of problem:

Resource limits and requests specified in {.spec.stepTemplate} for ClusterTask are not applied to the init-containers but only to the step containers;


Version-Release number of selected component (if applicable):
1.4

How reproducible:

100%

Steps to Reproduce:

1. Create ClusterTask with stepTemplate resource limits.

2. Start the clusterTask

3. using oc describe <taskrun generated pod>, verify that the limits and requests are only applied to the step containers and not to the init-containers.

Actual results:

The limits and requests are only applied to the step containers and not to the init-containers.


Expected results:

The limits and requests should be also applied to init-containers.

Additional info:

In case the project has LimitRange with {.spec.limits.default} field setted, the init-container takes the limits/requests from the LimitRange and not from the stepTemplate defined in the clusterTask resource.

Comment 4 Vincent Demeester 2021-08-30 12:22:33 UTC
For what is worth, this should be handled by the following work-in-progress PR upstream : https://github.com/tektoncd/pipeline/pull/4176

Comment 5 Mark Roberts 2022-02-08 09:26:51 UTC
I am seeing the same result when I move the resource limits from the specTemplate to the step as per the example below :

kind: Task
apiVersion: tekton.dev/v1beta1
metadata:
  name: test02
spec:  
  steps:
  - name: test
    image: alpine
    script: |
      echo EXECUTED
    resources:
      limits:
        cpu: "2"
        memory: 1Gi
      requests:
        cpu: "1"
        memory: 500Mi


My quota defintion applied to the project is :

apiVersion: v1
items:
- apiVersion: v1
  kind: ResourceQuota
  metadata:
    name: cust-quota
  spec:
    hard:
      limits.cpu: "4"
      limits.memory: 8Gi
      pods: "20"
      requests.cpu: "4"
      requests.memory: 8Gi
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

The only difference in this example is that the pod never appears for investigation and the taskrun result shows a message of :

failed to create task run pod "test02": pods "test02-pod-nvrd4" is forbidden: failed quota: cust-quota: must specify limits.cpu,limits.memory,requests.cpu,requests.memory. Maybe missing or invalid Task liberty-rest-gogs/test02

The task is present and perfectly valid as it works fine when the quota is removed.

Comment 10 Vincent Demeester 2022-07-19 09:11:46 UTC
Ah you are right. What got fixed in 1.6 is the fact that LimitRange where not applied to init container. But StepTemplate is, indeed not applied to to init containers. I think this is by designed, as init containers are not steps.

There have been evolution around this in the most recent version of Tekton Pipelines, mainly https://github.com/tektoncd/pipeline/pull/5059. This probably be something fixed in 1.9 (hopefully), but it's probably going to be very hard to backport it to 1.6 (as a lot of things changed since then).


Note You need to log in before you can comment on or make changes to this bug.