Merge pull request #126190 from mimowo/job-controller-cleanup

Cleanup Job controller isPodFailed function
This commit is contained in:
Kubernetes Prow Robot 2024-07-18 02:44:53 -07:00 committed by GitHub
commit 7693a7e71a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1901,16 +1901,11 @@ func ensureJobConditionStatus(list []batch.JobCondition, cType batch.JobConditio
}
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 {
return true
}
if onlyReplaceFailedPods(job) {
return p.Status.Phase == v1.PodFailed
return false
}
// Count deleted Pods as failures to account for orphan Pods that
// never have a chance to reach the Failed phase.