Cleanup Job controller isPodFailed function

This commit is contained in:
Michal Wozniak 2024-07-18 09:08:23 +02:00
parent 1b3d7d06c5
commit 1be4df6e02

View File

@ -1901,16 +1901,11 @@ func ensureJobConditionStatus(list []batch.JobCondition, cType batch.JobConditio
} }
func isPodFailed(p *v1.Pod, job *batch.Job) bool { func isPodFailed(p *v1.Pod, job *batch.Job) bool {
if job.Spec.PodFailurePolicy != nil {
// Orphan Pods and unschedulable terminating Pods are marked as Failed,
// so we only need to check the phase.
return p.Status.Phase == v1.PodFailed
}
if p.Status.Phase == v1.PodFailed { if p.Status.Phase == v1.PodFailed {
return true return true
} }
if onlyReplaceFailedPods(job) { if onlyReplaceFailedPods(job) {
return p.Status.Phase == v1.PodFailed return false
} }
// Count deleted Pods as failures to account for orphan Pods that // Count deleted Pods as failures to account for orphan Pods that
// never have a chance to reach the Failed phase. // never have a chance to reach the Failed phase.