Handle deprecated fields during conversion from v1beta1 to v1
This issue is for discussing how to implement conversion between v1beta1 and v1 CRDs, as proposed in TEP-0096. This conversation came up in tektoncd/community#587.
One question we will need to answer is how to handle the "resources" field of Task/TaskRun/Pipeline/PipelineRun, since these will be removed in v1.
Copying over a comment from @sbwsg:
We serialize the Finally section of a v1beta1 Pipeline into an annotation if a client requests the v1alpha1 version. When a client submits a v1alpha1 version of a Pipeline with that annotation present the process reverses and the v1beta1 object is recreated with the Finally section in-tact: https://github.com/tektoncd/pipeline/blob/7a0a988cafaa64ff3e08969fa66f8521638d9b52/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go#L142-L177
We don't do this for any other v1beta1-only fields. So, for example, when a v1alpha1 client requests a v1beta1 Pipeline with When Expressions, we simply drop them on the floor. If that client then re-applies the v1alpha1 version the stored v1beta1 version will be updated and the when expressions will be gone.
For a while we were working on an approach where we take the entire v1beta1 object and serialize it into an annotation when clients request v1alpha1, but it proved to be a complex and imperfect workaround.
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.
/lifecycle frozen
Should this be folded into #4983?
probably π
Added it to the linked issues in that epic! I think this still has value remaining open as a subtask, to discuss what we want to do when we update the stored version to v1 and need to implement conversion from v1beta1 to v1.
@afrittoli if you have any context about past pitfalls we ran into when supporting deprecated fields on conversion from v1alpha1 -> v1beta1 this issue is probably the best place for it!
We don't do this for any other v1beta1-only fields. So, for example, when a v1alpha1 client requests a v1beta1 Pipeline with When Expressions, we simply drop them on the floor. If that client then re-applies the v1alpha1 version the stored v1beta1 version will be updated and the when expressions will be gone.
Note that this can happen no matter what we do π. If the user / tool cleans the annotation(s), the situation is the same πΌπΌ