Repository navigation
fix: delete failed pod unless restartPolicy is Never - #4063
Monkeytesting wants to merge 2 commits into
Conversation
fix: delete failed pod unless restartPolicy is None Signed-off-by: Monkeytesting <15380790636@163.com>
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
🎉 Welcome to the Kubeflow Trainer! 🎉 Thanks for opening your first PR! We're happy to have you as part of our community 🚀 Here's what happens next:
Join the community:
Feel free to ask questions in the comments if you need any help or clarification! |
Signed-off-by: Monkeytesting <15380790636@163.com>
|
I tried this against the existing I'm not sure the Running → Failed → Running cycle can happen, though. Kubernetes only moves a pod to Could you share the status of one of the pods you saw cycling, for example |
fix: delete failed pod unless restartPolicy is Never
What this PR does / why we need it:
When a job is finished (Succeeded or Failed) with CleanPodPolicy: Running, pods in Failed state with RestartPolicy set to OnFailure or Always are not cleaned up properly. These pods keep cycling between Running → Failed → Running states indefinitely, causing resource leaks.
This PR fixes the cleanup logic to also delete Failed pods that are configured to restart (RestartPolicy != Never) when the job has finished. Since the job is already completed, these pods serve no purpose and should be cleaned up to release resources.
Changes:
Modified the cleanup condition in DeletePodsAndServices() to include Failed pods with restartable policies
Added comments explaining the edge case
Which issue(s) this PR fixes (optional, in
Fixes #<issue number>, #<issue number>, ...format, will close the issue(s) when PR gets merged):Fixes #
Checklist: