Merge pull request #130582 from tenzen-y/use-suspended-job-util

Job: Use jobSuspended util for suspended detection
This commit is contained in:
Kubernetes Prow Robot 2025-03-05 15:49:51 -08:00 committed by GitHub
commit 50927130ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1007,7 +1007,7 @@ func (jm *Controller) syncJob(ctx context.Context, key string) (rErr error) {
// Update the conditions / emit events only if manageJob was called in
// this syncJob. Otherwise wait for the right syncJob call to make
// updates.
if job.Spec.Suspend != nil && *job.Spec.Suspend {
if jobSuspended(&job) {
// Job can be in the suspended state only if it is NOT completed.
var isUpdated bool
job.Status.Conditions, isUpdated = ensureJobConditionStatus(job.Status.Conditions, batch.JobSuspended, v1.ConditionTrue, "JobSuspended", "Job suspended", jm.clock.Now())