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

Change the Storage Version to V1 Types #6444

Merged
merged 1 commit into from
Jun 16, 2023

Conversation

JeromeJu
Copy link
Member

@JeromeJu JeromeJu commented Mar 28, 2023

Changes

Prior to this PR, CRDs are stored in etcd as V1beta1 apiVersion. This commit swaps the storage version to V1 Types for Task, TaskRun, Pipeline and PipelineRun CRDs. From now on we could make changes only to the V1 APIs.

This PR makes the following changes:

  • switch storage to v1beta1 for Task, TaskRun, Pipeline and PipelineRun CRDs(config/)
  • use V1 types in controllers
  • convert v1 CRDs to v1beta1 for reconciling features that are not moved to V1 ie. CustomTask
    • it exports the ConvertFrom functions for v1beta1 Params, Workspaces and TaskRefs for v1beta1
      required fields to be reconciled when we swap to v1 storage version.
  • migrate the v1beta1 Yamls and tests following the migration guide
  • swap the RefSource and Params in remote resolution API from V1beta1 to V1
  • for tests and examples that are enabled on default in v1beta1, add beta to required-gates for features that are not defaulted in v1 but in v1beta1 ie. resolver_tests and move the examples under a beta folder

Closes #5541

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

action required:  for custom resolver users, please update to use v1.Param and v1.RefSource

@tekton-robot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 28, 2023
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 28, 2023
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 30, 2023
@tekton-robot tekton-robot added kind/misc Categorizes issue or PR as a miscellaneuous one. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 31, 2023
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 3, 2023
@JeromeJu JeromeJu force-pushed the v1-storage branch 2 times, most recently from 15332e7 to 70f157c Compare April 11, 2023 16:30
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 11, 2023
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelineref.go 93.1% 82.8% -10.3
pkg/reconciler/pipelinerun/resources/resultrefresolution.go 89.1% 79.6% -9.5
pkg/reconciler/taskrun/resources/taskref.go 89.7% 85.3% -4.4
pkg/resolution/resolver/cluster/resolver.go 84.0% 63.8% -20.2
pkg/result/result.go Do not exist 85.7%
pkg/taskrunmetrics/metrics.go 82.8% 83.1% 0.3

@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/reconciler/pipelinerun/resources/pipelineref.go 93.1% 82.8% -10.3
pkg/reconciler/pipelinerun/resources/resultrefresolution.go 89.1% 79.6% -9.5
pkg/reconciler/taskrun/resources/taskref.go 89.7% 85.3% -4.4
pkg/resolution/resolver/cluster/resolver.go 84.0% 63.8% -20.2
pkg/result/result.go Do not exist 85.7%
pkg/taskrunmetrics/metrics.go 82.8% 83.1% 0.3

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 13, 2023
@JeromeJu JeromeJu closed this Apr 13, 2023
@tekton-robot tekton-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 13, 2023
@JeromeJu JeromeJu reopened this Apr 13, 2023
@tekton-robot tekton-robot removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 13, 2023
@JeromeJu
Copy link
Member Author

JeromeJu commented Jun 16, 2023

Release Notes

for users with TektonCloudEventData, please update to use v1 Structs within the Event Data

The note here is not for users of this go API. This PR changes the content of CloudEvents produced by Tekton from v1beta1 to v1. So there is an action required for all users of CloudEvents produced by Tekton to adapt the logic in the even consumers to expect v1 instead of v1beta1.

The API version is actually not specified, see https://tekton.dev/docs/pipelines/events/, but there are changes between v1 and v1beta1, so we should warn users about that.

I think we should probably add to the events doc that the format of the resources is now v1. We do have a version number on the event type (e.g. dev.tekton.event.taskrun.started.v1), so perhaps we should switch those to v2. I think it would be nice to have a config flag that allows selecting which version of events to send, to start sending v2 but give an option to continue using v1 and deprecate v1.

All this said, perhaps the easiest option for this PR is to convert resources back to v1beta1 for sending CloudEvents, and then implement events v2 in a separate PR.

Thanks @afrittoli for the catch. That said, now we are converting back to v1beta1 TektonCloudEventDataType, we wouldn't need to put the release note for this for 'action required'.

I do appreciate this and opened #6839 to track this. Thanks for the suggestion for the workaround also 🙏

PTAL at the new commit that I pushed for the purpose of easier review, if that looks good, I am happy to squash it.

@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/reconciler/events/cloudevent/cloudevent.go 63.8% 64.2% 0.4
pkg/reconciler/pipelinerun/pipelinerun.go 91.2% 91.3% 0.2
pkg/reconciler/pipelinerun/resources/pipelineref.go 93.8% 92.9% -0.9
pkg/reconciler/taskrun/resources/taskref.go 90.0% 88.4% -1.6
pkg/reconciler/taskrun/taskrun.go 84.9% 84.8% -0.1
test/trustedresources.go 10.6% 8.9% -1.7

@JeromeJu
Copy link
Member Author

/test pull-tekton-pipeline-beta-integration-tests
flake: #6624

@JeromeJu JeromeJu force-pushed the v1-storage branch 2 times, most recently from 43f7952 to 37765c9 Compare June 16, 2023 16:25
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/events/cloudevent/cloudevent.go 63.8% 62.3% -1.5
pkg/reconciler/pipelinerun/pipelinerun.go 91.2% 91.3% 0.2
pkg/reconciler/pipelinerun/resources/pipelineref.go 93.8% 92.9% -0.9
pkg/reconciler/taskrun/resources/taskref.go 90.0% 88.4% -1.6
pkg/reconciler/taskrun/taskrun.go 84.9% 84.8% -0.1
test/trustedresources.go 10.6% 8.9% -1.7

@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/reconciler/events/cloudevent/cloudevent.go 63.8% 53.1% -10.7
pkg/reconciler/pipelinerun/pipelinerun.go 91.2% 91.3% 0.2
pkg/reconciler/pipelinerun/resources/pipelineref.go 93.8% 92.9% -0.9
pkg/reconciler/taskrun/resources/taskref.go 90.0% 88.4% -1.6
pkg/reconciler/taskrun/taskrun.go 84.9% 84.8% -0.1
test/trustedresources.go 10.6% 8.9% -1.7

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/events/cloudevent/cloudevent.go 63.8% 53.1% -10.7
pkg/reconciler/pipelinerun/pipelinerun.go 91.2% 91.3% 0.2
pkg/reconciler/pipelinerun/resources/pipelineref.go 93.8% 92.9% -0.9
pkg/reconciler/taskrun/resources/taskref.go 90.0% 88.4% -1.6
pkg/reconciler/taskrun/taskrun.go 84.9% 84.8% -0.1
test/trustedresources.go 10.6% 8.9% -1.7

var customRef *v1beta1.TaskRef
if rpt.PipelineTask.TaskRef != nil {
customRef = &v1beta1.TaskRef{}
customRef.ConvertFrom(ctx, *rpt.PipelineTask.TaskRef)
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add comments in the code about this?

@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/reconciler/events/cloudevent/cloudevent.go 63.8% 53.1% -10.7
pkg/reconciler/pipelinerun/pipelinerun.go 91.2% 91.3% 0.2
pkg/reconciler/pipelinerun/resources/pipelineref.go 93.8% 92.9% -0.9
pkg/reconciler/taskrun/resources/taskref.go 90.0% 88.4% -1.6
pkg/reconciler/taskrun/taskrun.go 84.9% 84.8% -0.1
test/trustedresources.go 10.6% 8.9% -1.7

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/events/cloudevent/cloudevent.go 63.8% 53.1% -10.7
pkg/reconciler/pipelinerun/pipelinerun.go 91.2% 91.3% 0.2
pkg/reconciler/pipelinerun/resources/pipelineref.go 93.8% 92.9% -0.9
pkg/reconciler/taskrun/resources/taskref.go 90.0% 88.4% -1.6
pkg/reconciler/taskrun/taskrun.go 84.9% 84.8% -0.1
test/trustedresources.go 10.6% 8.9% -1.7

expectedErr error
}{
{
Copy link
Member

Choose a reason for hiding this comment

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

NIT: I guess this does not need to be a loop anymore, it's just one test

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it could be but for the format of the expected error to fit in, it might work better with the tc box testing structs? :)

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 huge amount of work!

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.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2023
Prior to this PR, CRDs are stored in etcd as V1beta1 apiVersion. This commit swaps the storage version to V1 Types for Task, TaskRun, Pipeline and PipelineRun CRDs. From now on we could make changes only to the V1 APIs.

This PR makes the following changes:
- switch storage to v1beta1 for Task, TaskRun, Pipeline and PipelineRun CRDs(config/)
- use V1 types in controllers
- convert v1 CRDs to v1beta1 for reconciling features that are not moved to V1 ie. CustomTask
  - it exports the ConvertFrom functions for v1beta1 Params, Workspaces and TaskRefs for v1beta1
    required fields to be reconciled when we swap to v1 storage version.
- migrate the v1beta1 Yamls and tests following the [migration guide](https://github.com/tektoncd/pipeline/blob/main/docs/migrating-v1beta1-to-v1.md)
- swap the RefSource and Params in remote resolution API from V1beta1 to V1
- for tests and examples that are enabled on default in v1beta1, add beta to  for features that are not defaulted in v1 but in v1beta1 ie. resolver_tests and move the examples which requires enable-api-fields to beta under a beta folder
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2023
@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/reconciler/events/cloudevent/cloudevent.go 63.8% 53.1% -10.7
pkg/reconciler/pipelinerun/pipelinerun.go 91.2% 91.3% 0.2
pkg/reconciler/pipelinerun/resources/pipelineref.go 93.8% 92.9% -0.9
pkg/reconciler/taskrun/resources/taskref.go 90.0% 88.4% -1.6
pkg/reconciler/taskrun/taskrun.go 84.9% 84.8% -0.1
test/trustedresources.go 10.6% 8.9% -1.7

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/events/cloudevent/cloudevent.go 63.8% 53.1% -10.7
pkg/reconciler/pipelinerun/pipelinerun.go 91.2% 91.3% 0.2
pkg/reconciler/pipelinerun/resources/pipelineref.go 93.8% 92.9% -0.9
pkg/reconciler/taskrun/resources/taskref.go 90.0% 88.4% -1.6
pkg/reconciler/taskrun/taskrun.go 84.9% 84.8% -0.1
test/trustedresources.go 10.6% 8.9% -1.7

@lbernick
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2023
@tekton-robot tekton-robot merged commit 7384a67 into tektoncd:main Jun 16, 2023
@dibyom
Copy link
Member

dibyom commented Jun 16, 2023

Wooot!!! Thank you @JeromeJu !!!

@lbernick
Copy link
Member

/meow

@tekton-robot
Copy link
Collaborator

@lbernick: cat image

In response to this:

/meow

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.

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/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release v1 versions of Task, TaskRun, Pipeline, and PipelineRun CRDs
9 participants