Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEP of adding pipelinerun.spec.taskruntemplate #783

Merged
merged 1 commit into from
Sep 6, 2022

Conversation

yuzp1996
Copy link
Contributor

No description provided.

@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 15, 2022
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Aug 15, 2022
@yuzp1996
Copy link
Contributor Author

Related Issue: tektoncd/pipeline#5302

PR is not ready for review now! 😂

@yuzp1996 yuzp1996 changed the title WIP TEP of adding pipelinerun.spec.taskrunspectemplate [WIP] TEP of adding pipelinerun.spec.taskrunspectemplate Aug 15, 2022
@lbernick
Copy link
Member

/kind tep

@tekton-robot tekton-robot added the kind/tep Categorizes issue or PR as related to a TEP (or needs a TEP). label Aug 15, 2022
@dibyom
Copy link
Member

dibyom commented Aug 15, 2022

/assign @lbernick

Copy link
Member

@lbernick lbernick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @yuzp1996! would you mind removing the formatting changes from this PR?

## Proposal
Add filed taskRunSpecTemplate to PipelineRun.Spec then we can specify the common configuration in taskRunSpecTemplate, and the configuration will apply to all the TasRun.

```yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have an example of how the new field would be used to meet one of these use cases. For example, for use case number 1 (service accounts), the user might have a pipeline that clones and then runs unit tests, integration tests, and linters. They might want to use the same service account for all the tests, but a different service account for the clone. It would be helpful to include the pipeline definition as well. In this example, the taskRunTemplate has the same configuration as taskRunSpecs, which a user is unlikely to do.

vault.hashicorp.com/agent-inject-secret-foo: "/path/to/foo"
vault.hashicorp.com/role: role-name
// Add the following filed that same as taskRunSpecs
+ taskRunSpecTemplate:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should call this taskRunTemplate instead of taskRunSpecTemplate.

Expand pipelinerun.Spec and add taskRunSpecTemplate


```go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to include all this code here-- that can be discussed in a pull request. Instead, I'd recommend including an example of a user-configured PipelineRun before this change, and the same PipelineRun after this change.

(A good example is in the matrix TEP: https://github.com/tektoncd/community/blob/main/teps/0090-matrix.md#substituting-string-parameters-in-the-tasks. There's an example of what a PipelineRun would look like with this feature, and the same PipelineRun without this feature.)

@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 16, 2022
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 17, 2022
@yuzp1996 yuzp1996 changed the title [WIP] TEP of adding pipelinerun.spec.taskrunspectemplate TEP of adding pipelinerun.spec.taskrunspectemplate Aug 17, 2022
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 17, 2022
I want to specify compute resources that each TaskRun in my PipelineRun should run with, and don't want to have to specify them individually for each TaskRun.

## Proposal
Add filed taskRunTemplate to PipelineRun.Spec then users can specify common configuration in taskRunTemplate and the configuration will apply to all the TaskRun.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Add filed taskRunTemplate to PipelineRun.Spec then users can specify common configuration in taskRunTemplate and the configuration will apply to all the TaskRun.
Add field taskRunTemplate to PipelineRun.Spec so that users can specify common configuration in taskRunTemplate that will apply to all the TaskRuns.

@@ -0,0 +1,179 @@
---
status: proposed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be "implementable"

ComputeResources *corev1.ResourceRequirements `json:"computeResources,omitempty"`
}

// Reference PipelineTaskRunTemplate in PipelineRunSpec as filed TaskRunSpecTemplate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Reference PipelineTaskRunTemplate in PipelineRunSpec as filed TaskRunSpecTemplate
// Reference PipelineTaskRunTemplate in PipelineRunSpec via the field TaskRunSpecTemplate

computeResources:
requests:
cpu: 2
stepOverrides:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind removing stepOverrides from this example, as it can't be used along with computeResources?

Copy link
Contributor Author

@yuzp1996 yuzp1996 Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review @lbernick! I have synced the latest changes!

But I don't know why stepOverrides can not be used along with computeResources. Could you please help tell me the reason? Thanks! If so does this mean sidecarOverrides can only not be used along with computeResources either? 🙏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's explained in TEP-0104; basically it's two different ways of configuring compute resources that aren't really compatible with each other. We are probably going to deprecate stepOverrides (see #786)

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 17, 2022
@yuzp1996 yuzp1996 requested review from lbernick and removed request for houshengbo and pradeepitm12 August 18, 2022 02:44
@jerop
Copy link
Member

jerop commented Aug 22, 2022

@tektoncd/core-maintainers need a non-googler assignee, please take a look

@lbernick
Copy link
Member

@yuzp1996 would you mind updating this TEP to address moving podTemplate and serviceAccountName under taskRunTemplate, and clarifying that the changes will be made in v1 only? Thanks :)

@yuzp1996
Copy link
Contributor Author

I don't mind at all 😁. I'll do it when I'm fine.

@yuzp1996 yuzp1996 closed this Sep 1, 2022
@tekton-robot tekton-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 1, 2022
@yuzp1996 yuzp1996 reopened this Sep 1, 2022
@tekton-robot tekton-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 1, 2022
@yuzp1996 yuzp1996 requested review from vdemeester and removed request for lbernick September 1, 2022 23:41
@yuzp1996
Copy link
Contributor Author

yuzp1996 commented Sep 1, 2022

@vdemeester @lbernick Changes are synced, please correct me if I don't understand correctly.

@lbernick
Copy link
Member

lbernick commented Sep 2, 2022

this looks good to me! I'll let vincent take another look

We want to provide a convenient way to specify taskrun configuration

Now there is ServiceAccountName and PodTemplate can do the same thing so
we merge these two field to PipelineTaskRunTemplate and add metadata
sidecarOverrides annd computeResources to PipelineTaskRunTemplate.

Signed-off-by: yuzhipeng <yuzp1996@qq.com>
@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lbernick, vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@lbernick
Copy link
Member

lbernick commented Sep 6, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 6, 2022
@tekton-robot tekton-robot merged commit 9bf2ded into tektoncd:main Sep 6, 2022
@lbernick
Copy link
Member

lbernick commented Sep 7, 2022

FYI @jerop @abayer I realized this may affect pipelines in pipelines since the TEP states that pipelinerun.spec.serviceaccountname can be passed to child PipelineRuns. With serviceaccountname moved under taskRunTemplate, this might make less sense. Maybe when we explore creating pipelineRun.spec.pipelineRunSpecs we can also explore pipelineRun.spec.pipelineRunTemplate?

@jerop
Copy link
Member

jerop commented Sep 7, 2022

sure, let's gather initial feedback on taskRunTemplate and then explore adding customRunTemplate and pipelineRunTemplate

also noticed the title calls it taskrunspectemplate but the tep itself is taskruntemplate -- which one is it? (i prefer the latter)

@yuzp1996 yuzp1996 changed the title TEP of adding pipelinerun.spec.taskrunspectemplate TEP of adding pipelinerun.spec.taskruntemplate Sep 7, 2022
@lbernick
Copy link
Member

lbernick commented Sep 7, 2022

also noticed the title calls it taskrunspectemplate but the tep itself is taskruntemplate -- which one is it? (i prefer the latter)

it's the latter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/tep Categorizes issue or PR as related to a TEP (or needs a TEP). lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Status: UnAssigned
Development

Successfully merging this pull request may close these issues.

7 participants