Skip to content

Commit

Permalink
fix: keep updating task's min available number same as creating podgroup
Browse files Browse the repository at this point in the history
Signed-off-by: lowang_bh <lhui_wang@163.com>
  • Loading branch information
lowang-bh committed Apr 23, 2023
1 parent 86ff941 commit d797380
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/controllers/job/job_controller_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,20 +718,21 @@ func (cc *jobcontroller) createOrUpdatePodGroup(job *batch.Job) error {
}

for _, task := range job.Spec.Tasks {
if task.MinAvailable == nil {
continue
cnt := task.Replicas
if task.MinAvailable != nil {
cnt = *task.MinAvailable
}

if taskMember, ok := pg.Spec.MinTaskMember[task.Name]; !ok {
pgShouldUpdate = true
pg.Spec.MinTaskMember[task.Name] = *task.MinAvailable
pg.Spec.MinTaskMember[task.Name] = cnt
} else {
if taskMember == *task.MinAvailable {
if taskMember == cnt {
continue
}

pgShouldUpdate = true
pg.Spec.MinTaskMember[task.Name] = *task.MinAvailable
pg.Spec.MinTaskMember[task.Name] = cnt
}
}

Expand Down

0 comments on commit d797380

Please sign in to comment.