-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Revert removal of PipelineResources related fields #6436
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 🙏
We probably want to block creation of objects with these fields set in the validating webhook. Otherwise we'll accept and store objects with the fields set, even if we don't act on them.
Setting the JSON tag to "-" should take care of this (https://pkg.go.dev/encoding/json#Marshal). If I create the following task definition:
I get the error
|
That would also impact a client's ability to unmarshal json/yaml, so I don't think we can do that. 😞 Something else I thought of - we'll want to be careful of how we reject requests. If we start to reject an in-progress request that has already been previously accepted, we'll end up in a retry loop because we won't be able to update the object (even to mark it as failed). Ideally we'll only want to reject new requests (admission requests have the old state, so we should be able to detect this). 🤔 |
This commit brings back PipelineResources related fields to the API structs, marking them as deprecated and unused. The JSON tags are removed, so CRDs cannot be defined with these fields. Keeping these fields in the Go structs allows clients to maintain backwards compatibility with older servers, and allows downstream projects such as chains to continue to work with older CRDs that may define these fields.
I've fixed the serialization and added validation that these fields cannot be used. I'm a bit confused about the latter comment. Is the concern that a user who upgrades their server version will no longer be able to update old CRD definitions that contain PipelineResources, and the suggestion to only add this validation for Create requests and not update requests? I think rejecting is a reasonable choice to make-- our release notes for #6150 state that this will break pipelineresources. |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
Kinda - it's a niche edge case, but the concern is for pending runs that didn't get to execute before the update and the controller's ability to modify them. When the new controller picks up the unfinished run, will the validating webhook deny status updates to the run because a pipeline resource is set? If the answer is yes then the resource will be stuck as pending in a retry loop because the reconciler can't update the status to mark the run as completed (even for failure). I don't know if this is actually a problem - I'm not sure how k8s handles validation webhooks for status updates (it might be okay if the validating webhook doesn't trigger on updates to the status subresource). You could probably simulate this by doing something like:
There's also a secondary issue of when the new reconciler picks up an existing pending run that had pipeline resources set, should it fail the run or continue as if the user never specified it? I can see both sides here 🤷 |
We had some similar discussion on #5999 about guaranteeing the behavior of running pipelineruns when someone flips a feature flag, and we decided not to. This seems like a similar question; should we guarantee what happens to running pipelineruns when you update pipelines, and I think the same decision probably applies. It also seems like a lot of the reason to bring these fields back is for clients to be able to handle older servers, not to extend the lifespan of CRDs using pipelineresources, so I'm not sure we should try to address this edge case. |
Talked with @lbernick off-thread. I'll create another issue for discussion how we want to handle avoiding reconcile loops in general (this also affects feature flags) For this PR we're going to move ahead with the current implementation with a release note with a short script for how to identify and delete and pending taskruns that might be stuck in a problematic state. |
Thanks @wlynch, release notes updated! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Release notes script should be taskruns instead of tasks, but otherwise
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wlynch 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 |
When we reverted removal of `PipelineResources` [related fields](tektoncd#6436), we did not recover the conversion functions. As a result, when migrating Tekton Chains to watch `v1` objects, we run into Issue tektoncd#7105. This PR recovers the conversion functions so that we can continue to convert PipelineResources related fields.
When we reverted removal of `PipelineResources` [related fields](tektoncd#6436), we did not recover the conversion functions. As a result, when migrating Tekton Chains to watch `v1` objects, we run into Issue tektoncd#7105. This PR recovers the conversion functions so that we can continue to convert PipelineResources related fields.
When we reverted removal of `PipelineResources` [related fields](#6436), we did not recover the conversion functions. As a result, when migrating Tekton Chains to watch `v1` objects, we run into Issue #7105. This PR recovers the conversion functions so that we can continue to convert PipelineResources related fields.
This commit brings back PipelineResources related fields to the API structs, marking them as deprecated and unused. The JSON tags are removed, so CRDs cannot be defined with these fields. Keeping these fields in the Go structs allows clients to maintain backwards compatibility with older servers, and allows downstream projects such as chains to continue to work with older CRDs that may define these fields.
Closes #6430
/kind misc
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes