diff --git a/pkg/controllers/apis/job_info.go b/pkg/controllers/apis/job_info.go index 2094ed0a1b..aec52378b5 100644 --- a/pkg/controllers/apis/job_info.go +++ b/pkg/controllers/apis/job_info.go @@ -40,11 +40,11 @@ func (ji *JobInfo) Clone() *JobInfo { Name: ji.Name, Job: ji.Job, - Pods: make(map[string]map[string]*v1.Pod), + Pods: make(map[string]map[string]*v1.Pod, len(ji.Pods)), } for key, pods := range ji.Pods { - job.Pods[key] = make(map[string]*v1.Pod) + job.Pods[key] = make(map[string]*v1.Pod, len(pods)) for pn, pod := range pods { job.Pods[key][pn] = pod } diff --git a/pkg/scheduler/api/job_info.go b/pkg/scheduler/api/job_info.go index f4b4601aa9..efb0316e96 100644 --- a/pkg/scheduler/api/job_info.go +++ b/pkg/scheduler/api/job_info.go @@ -574,7 +574,7 @@ func (ji *JobInfo) Clone() *JobInfo { PodGroup: ji.PodGroup.Clone(), TaskStatusIndex: map[TaskStatus]tasksMap{}, - TaskMinAvailable: make(map[TaskID]int32), + TaskMinAvailable: make(map[TaskID]int32, len(ji.TaskMinAvailable)), TaskMinAvailableTotal: ji.TaskMinAvailableTotal, Tasks: tasksMap{}, Preemptable: ji.Preemptable,