-
Notifications
You must be signed in to change notification settings - Fork 133
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
feat: update chain's controllers to support both v1beta1 and v1 Tekton APIs via ConfigMap #1006
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The following is the coverage report on the affected files.
|
ff59343
to
b6dcecc
Compare
The following is the coverage report on the affected files.
|
b6dcecc
to
ec2ea93
Compare
The following is the coverage report on the affected files.
|
ec2ea93
to
5f345eb
Compare
The following is the coverage report on the affected files.
|
5f345eb
to
a6b0489
Compare
The following is the coverage report on the affected files.
|
ed85c4c
to
67b0dfd
Compare
The following is the coverage report on the affected files.
|
67b0dfd
to
f960d40
Compare
The following is the coverage report on the affected files.
|
f960d40
to
5dc235e
Compare
The following is the coverage report on the affected files.
|
5dc235e
to
c3ef7d2
Compare
The following is the coverage report on the affected files.
|
c3ef7d2
to
866f0b6
Compare
The following is the coverage report on the affected files.
|
866f0b6
to
459b5ad
Compare
The following is the coverage report on the affected files.
|
459b5ad
to
4f28d75
Compare
The following is the coverage report on the affected files.
|
4f28d75
to
9ea843f
Compare
c9a6f85
to
0056ce8
Compare
ae94c01
to
d6a57ec
Compare
The following is the coverage report on the affected files.
|
2c8660b
to
ea2aaad
Compare
The following is the coverage report on the affected files.
|
ea2aaad
to
6fe2a77
Compare
The following is the coverage report on the affected files.
|
6fe2a77
to
d958bc6
Compare
The following is the coverage report on the affected files.
|
d958bc6
to
4c53600
Compare
The following is the coverage report on the affected files.
|
4c53600
to
708b3c6
Compare
The following is the coverage report on the affected files.
|
708b3c6
to
331740b
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
c350ceb
to
e71bef9
Compare
The following is the coverage report on the affected files.
|
e71bef9
to
f36bab3
Compare
The following is the coverage report on the affected files.
|
… converting to v1beta1 to keep formats backwards compatible
f36bab3
to
e752b01
Compare
The following is the coverage report on the affected files.
|
/assign |
fixes #665 , fixes #985, fixes #986, fixes #987
This PR updates chains to natively use the Tekton Pipeline
v1
API ("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"), updated from the Tekton Pipelinev1beta1
API ("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"). This PR additionally adds backwards compatibility support forv1beta1
Tekton Objects by adding an additional controller ([pipelinerun|taskrun].NewControllerV1Beta1
) that can be toggled so that users can watch v1beta1 objects. The usage of either the v1 controller or the v1beta1 controller is toggled via a newbool
chains ConfigMap option -tektonAPI.watchForTektonV1Beta1APIInstead
. Internally in the provenance and signing logic v1 Tekton object representation is used w/ v1beta1 objects being converted in/out of v1 as needed for processing fields.The backwards compatibility works as v1beta1 and v1 Tekton APIs can be converted between types. Due to v1beta1 changes over time, some fields have their own bespoke support (v1beta1 TaskRun
.Spec.Resources
, and.Status.TaskRunStatusField.TaskSpec.Resources
). The implementation for the backwards compatibility w/ v1beta1 is designed around all of the chains methods supporting V1 TaskRun's + some bespoke logic for getting information from deprecated fields in V1. The flow for this is that when a V1Beta1 Tekton Objects is received by the controller, it convert it to a V1 object and adds some serialized information to theannotations
(similar to https://github.com/tektoncd/pipeline/blob/main/pkg/apis/pipeline/v1beta1/taskrun_conversion.go, we would just rely on this but due to changes in v1beta1 over time the conversion methods no longer support what chains supported. See this PR here for an example - https://github.com/tektoncd/pipeline/pull/6150/files#diff-b9722861f4853020c0d7b0e17e92ffbf720b74b9c6e5550387ba3157dd210c94).For a V1 object using the V1 controller, the flow is straightforward like it was initially with V1 objects being used throughout the signing process
For a V1Beta1 object using the v1beta1 controller, the flow has 4 main steps:
annotations
that chains might need to use later when re-converting..Spec.Resources
,.Spec.ResourceResults
, or.Status.TaskRunStatusField.TaskSpec.Resources
we convert the V1 object back to V1Beta1 (using Tekton Pipeline conversion lib + bespoke deserialization code) and extract the necessary information as was done prior. Then the V1 Provenance is uploaded..Patch
to be updated w/ chains annoations noting it was signed, etc.The changes required were broadly the following:
objects.go
TektonObject
interface to be more generic to support to v1beta1 and v1 objects (some interface types were versioned @ HEAD -Result
&Provenance
). Making the controller more natively support v1beta1 and v1 is non-trivial as in many places the TektonObject is cast back to a versioned type (eg: v1, or @ priort-to-this-pr v1beta1) for reading fields directly, etcOpen Questions:
tektonAPI.watchForTektonV1Beta1APIInstead
toggling the other controller into inactivity?