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

restricting tekton.dev labels in metadata #2891

Closed
wants to merge 1 commit into from

Conversation

pritidesai
Copy link
Member

@pritidesai pritidesai commented Jul 2, 2020

Changes

Tekton resources are automatically assigned certain labels including the ones with tekton.dev. The labels are created and propagated from one resource to another using this group name. We should restrict possibility of overwriting those labels otherwise it could result in conflicting resources.

Result of the discussion in PR 2826

On hold until we confirm this is something we want to restrict 🤔

This will break folks using these labels in metadata, see an example in catalog.

/cc @vdemeester

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

Restricting user defined tekton.dev/ labels.

@tekton-robot tekton-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Jul 2, 2020
@tekton-robot tekton-robot requested review from dlorenc and a user July 2, 2020 22:37
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 2, 2020
@tekton-robot
Copy link
Collaborator

This PR cannot be merged: expecting exactly one kind/ label

Available kind/ labels are:

kind/question: Issues or PRs that are questions around the project or a particular feature
kind/bug: Categorizes issue or PR as related to a bug.
kind/flake: Categorizes issue or PR as related to a flakey test
kind/cleanup: Categorizes issue or PR as related to cleaning up code, process, or technical debt.
kind/design: Categorizes issue or PR as related to design.
kind/documentation: Categorizes issue or PR as related to documentation.
kind/feature: Categorizes issue or PR as related to a new feature.
kind/misc: Categorizes issue or PR as a miscellaneuous one.

@pritidesai
Copy link
Member Author

pritidesai commented Jul 2, 2020

/kind misc
/hold

@tekton-robot tekton-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/misc Categorizes issue or PR as a miscellaneuous one. labels Jul 2, 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/apis/validate/metadata.go 83.3% 88.9% 5.6

@pritidesai pritidesai changed the title restricting tekton.dev in metadata restricting tekton.dev labels in metadata Jul 2, 2020
@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 3, 2020
@vdemeester
Copy link
Member

This will break folks using these labels in metadata, see an example in catalog.

Interesting, those catalog task shouldn't use that label anyway as it is supposed to be set by the controller 🤔

@pritidesai
Copy link
Member Author

This will break folks using these labels in metadata, see an example in catalog.

Interesting, those catalog task shouldn't use that label anyway as it is supposed to be set by the controller 🤔

Yup, indeed, @bobcatfish @sbwsg WDYT?

@dlorenc
Copy link
Contributor

dlorenc commented Jul 15, 2020

Yup, indeed, @bobcatfish @sbwsg WDYT?

Ref #2946 - we should probably document this there too

@dlorenc
Copy link
Contributor

dlorenc commented Jul 15, 2020

Yup, indeed, @bobcatfish @sbwsg WDYT?

Is it actually "used" there? The catalog reorg happened so I had to hunt them down (the links changed). Here it is now: https://github.com/tektoncd/catalog/blob/d7e5c6db536d79bd3c205caaf075a50f5c9dee7e/task/github-close-issue/0.1/README.md

They only really appear in the READMEs for examples on creating a TaskRun. My wild guess is that someone created the taskrun with the CLI or something, then dumped it as YAML to generate the docs and kept that label.

It's only in 3 places:
image


// metadata must not contain any label with tekton.dev/*
for k := range meta.GetLabels() {
if strings.HasPrefix(k, pipeline.GroupName) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we care/have an opinion on things like "*.tekton.dev" as well?

Copy link
Member Author

@pritidesai pritidesai Jul 16, 2020

Choose a reason for hiding this comment

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

This is meant to be Tekton internal, created and utilized by the pipeline controller itself, better to enforce rather than relying on Task/Pipeline/TaskRun/PipelineRun authors to follow recommendations, thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

@dlorenc good point. I would think we should reserve tekton.dev and most likely pipelines.tekton.dev (future-proof 😅 ), but given some proposals, we shouldn't restrict all the *.tekton.dev 🙃

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 on saving the extra namespace. In chains right now we're using "chains.tekton.dev", but only in an annotation.

Copy link
Member Author

Choose a reason for hiding this comment

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

This PR is restricting labels, annotations have all the freedom 😉

@tekton-robot
Copy link
Collaborator

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

/lifecycle rotten

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Aug 17, 2020
@vdemeester
Copy link
Member

/remove-lifecycle rotten

@tekton-robot tekton-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Sep 15, 2020
@vdemeester
Copy link
Member

cc @tektoncd/core-maintainers

@ghost
Copy link

ghost commented Sep 15, 2020

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbwsg

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 Sep 15, 2020
@dibyom
Copy link
Member

dibyom commented Sep 15, 2020

Tekton resources are automatically assigned certain labels including the ones with tekton.dev. The labels are created and propagated from one resource to another using this group name. We should restrict possibility of overwriting those labels otherwise it could result in conflicting resources.

Sounds good to me!

@vdemeester
Copy link
Member

/retest

Tekton resources are automatically assigned certain labels including the
ones with tekton.dev. The labels are created and propagated from one
resource to another using this group name. We should restrict possibility
of overwriting those labels otherwise it could result in conflicting resources.
@afrittoli
Copy link
Member

/test pull-tekton-pipeline-integration-tests

for k := range meta.GetLabels() {
if strings.HasPrefix(k, pipeline.GroupName) {
return &apis.FieldError{
Message: "Invalid label key: can not change tekton resource name",
Copy link
Member

Choose a reason for hiding this comment

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

NIT: the error message may be confusing if someone is not trying to change the resource name. I think it would be better to say that the tekton.dev/ labels are reserved for internal use.

@afrittoli
Copy link
Member

We do use tekton.dev labels in plumbing, so I need to change those before we install this :)

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

Thanks for this!
I would update the error message, but otherwise it looks good to me.
I think we can reserve extra namespace in further PRs if we decide to?
@pritidesai is the "hold" still needed on this one?

@pritidesai
Copy link
Member Author

thanks. Nope, no more hold needed.
/hold cancel
/test pull-tekton-pipeline-integration-tests

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 25, 2020
@pritidesai
Copy link
Member Author

We do use tekton.dev labels in plumbing, so I need to change those before we install this :)

Could this be causing integration failure? 🤔 Integration tests failure is consistent with these changes in terms of number of failing Tests:

162 failed / 9 succeeded

@pritidesai
Copy link
Member Author

16 test examples showing this error:

TestExamples/v1alpha1/pipelineruns/conditional-pipelinerun-with-same-condition-refer: examples_test.go:57: Failed waiting for pipeline run done: timed out waiting for the condition

@pritidesai
Copy link
Member Author

This is actually a legit failure 😢 not related to infra or timeout.

Taskrun and Pipelinerun controller injects these labels which are then going through the same validation routine which validates user specified labels. Will update this PR to separate this validation calls next week, putting it on hold until then.

/hold

@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 Sep 25, 2020
@vdemeester
Copy link
Member

/lgtm cancel

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 7, 2020
@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 Jan 5, 2021
@vdemeester
Copy link
Member

/remove-lifecycle stale
@tektoncd/core-maintainers what should we do here ?

@tekton-robot tekton-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 5, 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/apis/validate/metadata.go 83.3% 88.9% 5.6

@tekton-robot
Copy link
Collaborator

@pritidesai: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-tekton-pipeline-unit-tests beaf288 link /test tekton-pipeline-unit-tests
pull-tekton-pipeline-integration-tests beaf288 link /test pull-tekton-pipeline-integration-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

@pritidesai: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-tekton-pipeline-unit-tests beaf288 link /test tekton-pipeline-unit-tests
pull-tekton-pipeline-integration-tests beaf288 link /test pull-tekton-pipeline-integration-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 tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 24, 2021
@tekton-robot
Copy link
Collaborator

@pritidesai: 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.

@vdemeester
Copy link
Member

@pritidesai @tektoncd/core-maintainers gentle ping 👼🏼

@pritidesai
Copy link
Member Author

thanks @vdemeester its a long overdue, will look into it this week 🙏

@pritidesai pritidesai mentioned this pull request Aug 13, 2021
5 tasks
@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 Oct 15, 2021
@pritidesai
Copy link
Member Author

closing this for now, will open a new PR once I have a breather to implement this. I have created an issue capturing the PR discussion here.

@pritidesai pritidesai closed this Nov 9, 2021
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/misc Categorizes issue or PR as a miscellaneuous one. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants