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

Add support for env in podtemplate #3566

Closed
wants to merge 1 commit into from

Conversation

piyush-garg
Copy link
Contributor

@piyush-garg piyush-garg commented Nov 30, 2020

This will help to specificy env default, env at pipelinerun
and taskrun level. Env in pod template at taskrun and pipelinerun
level will take precedence over one defined in step and stepTemplate

Env at pipelinerun and taskrun level will override the
default podtemplate

Fix #1606

/kind feature

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

Add support for env in default podTemplate, pipelinerun podTemplate and taskrun podTemplate

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Nov 30, 2020
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 30, 2020
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/pod/pod.go 87.4% 88.3% 0.9

@vdemeester vdemeester self-requested a review November 30, 2020 09:20
@chmouel
Copy link
Member

chmouel commented Nov 30, 2020

This look good, maybe add an example ? The same way we have on that example ?

Copy link
Member

@jerop jerop left a comment

Choose a reason for hiding this comment

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

@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 8, 2020
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/pod/pod.go 87.4% 89.2% 1.8

@piyush-garg
Copy link
Contributor Author

@chmouel @vdemeester @jerop I have updated the PR with tests, docs and examples

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/pod/pod.go 87.4% 89.2% 1.8

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/pod/pod.go 87.4% 89.2% 1.8

This will help to specificy env default, env at pipelinerun
and taskrun level. Env in pod template at taskrun and pipelinerun
level will take precedence over one defined in step and stepTemplate

Env at pipelinerun and taskrun level will override the
default podtemplate

Fix tektoncd#1606
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/pod/pod.go 87.4% 89.2% 1.8

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/pod/pod.go 87.4% 89.2% 1.8

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 8, 2020
Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

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

I'm surprised we didn't want to go ahead with a TEP on this @vdemeester ?

I traced back in the API working group notes and found our discussion on july 20

I know it's a pain to ask for a TEP after the work is already done, but I feel like if it wasn't already done, a TEP would be totally reasonable? Esp. given that this is controversial - or at least it is controversial to me b/c I think folks could use this in such a way that Tekton will replicate the mistakes of other CI/CD systems (which is ironically the motivation for this feature afaik, e.g. migrating from jenkins)

A couple things we might want to cover in a TEP:

  • do we want to do this in the pod template or do we want this to be a top level feature? (so it's more obvious) this would also give us more control over which containers these env vars are provided to if we want it
  • one thing in the working group I suggested was do we want to make it so that Tasks have to opt into this functionality somehow, i.e. so when you look at a task it's obvious it will also accept some undeclared list of env vars

/hold

@@ -49,6 +49,10 @@ Pod templates support fields listed in the table below.
<td><code>volumes</code></td>
<td>Specifies a list of volumes that containers within the Pod can mount. This allows you to specify a volume type for each <code>volumeMount</code> in a <code>Task</code>.</td>
</tr>
<tr>
<td><code>env</code></td>
<td>Specifies a list of environments that all containers within the Pod will be populated</td>
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: environments -> environment variables?

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 8, 2020
@vdemeester
Copy link
Member

I'm surprised we didn't want to go ahead with a TEP on this @vdemeester ?

I traced back in the API working group notes and found our discussion on july 20

I know it's a pain to ask for a TEP after the work is already done, but I feel like if it wasn't already done, a TEP would be totally reasonable? Esp. given that this is controversial - or at least it is controversial to me b/c I think folks could use this in such a way that Tekton will replicate the mistakes of other CI/CD systems (which is ironically the motivation for this feature afaik, e.g. migrating from jenkins)

A couple things we might want to cover in a TEP:

  • do we want to do this in the pod template or do we want this to be a top level feature? (so it's more obvious) this would also give us more control over which containers these env vars are provided to if we want it
  • one thing in the working group I suggested was do we want to make it so that Tasks have to opt into this functionality somehow, i.e. so when you look at a task it's obvious it will also accept some undeclared list of env vars

/hold

Agreed on all those 🙃

@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 8, 2021
Base automatically changed from master to main March 11, 2021 15:28
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/pod/pod.go 87.4% 89.2% 1.8

@tekton-robot
Copy link
Collaborator

@piyush-garg: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-tekton-pipeline-integration-tests eb22c76 link /test pull-tekton-pipeline-integration-tests
pull-tekton-pipeline-build-tests eb22c76 link /test pull-tekton-pipeline-build-tests

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

1 similar comment
@tekton-robot
Copy link
Collaborator

@piyush-garg: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-tekton-pipeline-integration-tests eb22c76 link /test pull-tekton-pipeline-integration-tests
pull-tekton-pipeline-build-tests eb22c76 link /test pull-tekton-pipeline-build-tests

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@tekton-robot
Copy link
Collaborator

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 10, 2021
@tekton-robot
Copy link
Collaborator

@piyush-garg: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 22, 2021
@tekton-robot
Copy link
Collaborator

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen with a justification.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

@tekton-robot
Copy link
Collaborator

@tekton-robot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen with a justification.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@afrittoli
Copy link
Member

@vdemeester @piyush-garg any plan to bring this back to live? AFAIK most of the discussion already happened, it was only a matter of formalising it via TEP?

Udiknedormin referenced this pull request in rafalbigaj/community Dec 21, 2021
This document proposes support for environment variables configuration in `podTemplate`. That allows to exclude common variables to the global level as well as overwrite defaults specified on the particular step level.
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide mechanism to set environment variables on TaskRuns
7 participants