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

Cancel TaskRuns using entrypoint binary #3238

Open
imjasonh opened this issue Sep 15, 2020 · 9 comments
Open

Cancel TaskRuns using entrypoint binary #3238

imjasonh opened this issue Sep 15, 2020 · 9 comments
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.

Comments

@imjasonh
Copy link
Member

Today

When a TaskRun is cancelled, the TaskRun controller deletes the TaskRun's underlying Pod. This stops execution ~immediately, but also leads Kubernetes to reap the Pod's logs.

Feature Request

In #2559, we're discussing enforcing TaskRun-level timeouts in the entrypoint binary, so that timed-out TaskRun Pods don't get deleted and any logs lost. Instead of deleting the Pod, the entrypoint binary that runs each step will just stop executing and fail any running step, and not run any subsequent steps.

If we end up doing that, we could also enforce cancellation in the entrypoint binary, which would let us keep Pods and logs around for cancelled TaskRuns too.

To accomplish this, the entrypoint binary could take a new flag -cancel_file, which is a Downard API volume populated from a Pod annotation -- this is similar to how we signal the first step to start only after all sidecars are ready. In this model, when a TaskRun is cancelled, the TaskRun controller would annotate the Pod with, for example "cancelled=true", which would update the contents of the projected file, which the entrypoint binary would see, then it can stop executing the currently running step.

This behavior change should be guarded by a feature flag (opt-in at first) since some users might depend on the current behavior. This also gives us an opportunity to compare behavior and timing of cancellation between the two implementations.

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 15, 2020
@bobcatfish
Copy link
Collaborator

Makes sense to me to revisit this!

@imjasonh are there any other options that are worth evaluating for this? For example, we could send a signal that the entrypoint binary could catch - iirc the only reason we haven't relied more on signals is b/c we haven't been able to rely on how some arbitrary process will handle it; we can control the entrypoint binary tho 🤔

I think @sbwsg has looked into this as well in the context of the initial cancellation feature

@bobcatfish bobcatfish added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Sep 15, 2020
@imjasonh
Copy link
Member Author

Can we send signals to containers in the pod from the controller? I didn't think that was an option, so we've relied on file-existence checks backed by Downard volumes instead.

We've also discussed having a sidecar in the Pod that can accept RPCs from the controller, but that's a much larger change, and ultimately sort of orthogonal to how entrypoint stops the user's entrypoint execution.

@ghost ghost added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed priority/backlog Higher priority than priority/awaiting-more-evidence. labels Oct 5, 2020
@tekton-robot
Copy link
Collaborator

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 tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 3, 2021
@vdemeester
Copy link
Member

/remove-lifecycle stale
/lifecycle frozen

Putting this in the "frozen" box as this is something that is worth exploring 🙃

@tekton-robot tekton-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 5, 2021
@dibyom dibyom added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Mar 9, 2021
adshmh added a commit to adshmh/pipeline that referenced this issue Feb 24, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
adshmh added a commit to adshmh/pipeline that referenced this issue Feb 24, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
adshmh added a commit to adshmh/pipeline that referenced this issue Mar 6, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
adshmh added a commit to adshmh/pipeline that referenced this issue Mar 27, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
adshmh added a commit to adshmh/pipeline that referenced this issue Mar 27, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
adshmh added a commit to adshmh/pipeline that referenced this issue Mar 27, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
vdemeester pushed a commit to vdemeester/tektoncd-pipeline that referenced this issue Jul 5, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
vdemeester pushed a commit to vdemeester/tektoncd-pipeline that referenced this issue Aug 31, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
vdemeester pushed a commit to vdemeester/tektoncd-pipeline that referenced this issue Aug 31, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
vdemeester pushed a commit to vdemeester/tektoncd-pipeline that referenced this issue Sep 6, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
vdemeester pushed a commit to vdemeester/tektoncd-pipeline that referenced this issue Oct 5, 2022
The cancellation of taskruns is now done through the entrypoint binary
through a new flag called 'cancel_file'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
@chengjoey
Copy link
Member

Is this still a work in progress, I would love to implement it

@vdemeester
Copy link
Member

@chengjoey I didn't have time to keep the PR up-to-date, etc.. so yes, please go ahead 🙏🏼

@chengjoey
Copy link
Member

/assign

chengjoey added a commit to chengjoey/pipeline that referenced this issue Apr 8, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue Apr 10, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue Apr 10, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue Apr 10, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue Apr 10, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue Apr 17, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue May 24, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey pushed a commit to chengjoey/pipeline that referenced this issue Jul 26, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey pushed a commit to chengjoey/pipeline that referenced this issue Jul 26, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey pushed a commit to chengjoey/pipeline that referenced this issue Jul 26, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey pushed a commit to chengjoey/pipeline that referenced this issue Jul 26, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey pushed a commit to chengjoey/pipeline that referenced this issue Aug 9, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue Aug 23, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue Aug 29, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue Aug 29, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue Sep 21, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
chengjoey added a commit to chengjoey/pipeline that referenced this issue Oct 17, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
tekton-robot pushed a commit that referenced this issue Oct 17, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue #3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
JeromeJu pushed a commit to JeromeJu/pipeline that referenced this issue Oct 17, 2023
through a new flag called 'stop_on_cancel'. This removes the need for
deleting the pods to cancel a taskrun, allowing examination of the logs
on the pods from cancelled taskruns. Part of work on issue tektoncd#3238

Signed-off-by: chengjoey <zchengjoey@gmail.com>
@paulweb515
Copy link

Hi, How close is this?

@AlanGreene
Copy link
Member

I think this can be enabled via the keep-pod-on-cancel feature flag since v0.53, but is still disabled by default.

Not sure what work is outstanding @chengjoey @JeromeJu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
Status: Todo
Development

No branches or pull requests

8 participants