pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

Handle deprecated fields during conversion from v1beta1 to v1

Open lbernick opened this issue 3 years ago β€’ 5 comments

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.

lbernick avatar Feb 04 '22 14:02 lbernick

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 avatar May 05 '22 14:05 tekton-robot

/lifecycle frozen

vdemeester avatar May 05 '22 15:05 vdemeester

Should this be folded into #4983?

abayer avatar Jun 23 '22 19:06 abayer

probably πŸ™ƒ

vdemeester avatar Jun 27 '22 09:06 vdemeester

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.

lbernick avatar Jun 27 '22 15:06 lbernick

@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!

lbernick avatar Sep 26 '22 18:09 lbernick

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 πŸ‘ΌπŸΌ

vdemeester avatar Sep 28 '22 06:09 vdemeester