@@ -30,7 +30,7 @@ func (t *topologyPlugin) prePredicateFn(_ *pod_info.PodInfo, job *podgroup_info.
3030 return nil
3131 }
3232
33- defer t .treeAllocateableCleanup (topologyTree )
33+ defer t .treeAllocatableCleanup (topologyTree )
3434 maxAllocatablePods , err := t .calcTreeAllocatable (job , topologyTree )
3535 if err != nil {
3636 return err
@@ -42,7 +42,7 @@ func (t *topologyPlugin) prePredicateFn(_ *pod_info.PodInfo, job *podgroup_info.
4242 return nil
4343 }
4444
45- _ , err = t .getBestjobAllocateableDomains (job , topologyTree )
45+ _ , err = t .getBestJobAllocatableDomains (job , topologyTree )
4646 if err != nil {
4747 return err
4848 }
@@ -105,42 +105,42 @@ func (t *topologyPlugin) calcSubTreeAllocatable(jobAllocationData *jobAllocation
105105 }
106106
107107 for _ , child := range rootDomain .Children {
108- childAllocateable , err := t .calcSubTreeAllocatable (jobAllocationData , child )
108+ childAllocatable , err := t .calcSubTreeAllocatable (jobAllocationData , child )
109109 if err != nil {
110110 return 0 , err
111111 }
112- rootDomain .AllocatablePods += childAllocateable
112+ rootDomain .AllocatablePods += childAllocatable
113113 }
114114 return rootDomain .AllocatablePods , nil
115115}
116116
117117func calcNodeAccommodation (jobAllocationMetaData * jobAllocationMetaData , node * node_info.NodeInfo ) int {
118- allocateablePodsCount := 0
118+ allocatablePodsCount := 0
119119 for _ , resourceRepresentorPod := range jobAllocationMetaData .allocationTestPods {
120120 if node .IsTaskAllocatable (resourceRepresentorPod ) {
121- allocateablePodsCount ++
121+ allocatablePodsCount ++
122122 } else {
123123 break
124124 }
125125 }
126126 // Add more to jobResourcesAllocationsRepresentors until node cannot accommodate any more pods
127- if allocateablePodsCount == len (jobAllocationMetaData .allocationTestPods ) {
128- for i := allocateablePodsCount ; i < len (jobAllocationMetaData .tasksToAllocate ); i ++ {
127+ if allocatablePodsCount == len (jobAllocationMetaData .allocationTestPods ) {
128+ for i := allocatablePodsCount ; i < len (jobAllocationMetaData .tasksToAllocate ); i ++ {
129129 latestTestPod := jobAllocationMetaData .allocationTestPods [len (jobAllocationMetaData .allocationTestPods )- 1 ]
130130
131131 iAllocationsTestPod := & pod_info.PodInfo {
132- Name : fmt .Sprintf ("%d-pods-resources" , allocateablePodsCount + 1 ),
132+ Name : fmt .Sprintf ("%d-pods-resources" , allocatablePodsCount + 1 ),
133133 ResReq : calcNextAllocationTestPodResources (latestTestPod .ResReq , jobAllocationMetaData .maxPodResources ),
134134 }
135135 jobAllocationMetaData .allocationTestPods = append (jobAllocationMetaData .allocationTestPods , iAllocationsTestPod )
136136 if node .IsTaskAllocatable (iAllocationsTestPod ) {
137- allocateablePodsCount ++
137+ allocatablePodsCount ++
138138 } else {
139139 break
140140 }
141141 }
142142 }
143- return allocateablePodsCount
143+ return allocatablePodsCount
144144}
145145
146146func calcNextAllocationTestPodResources (previousTestResources , maxPodResources * resource_info.ResourceRequirements ) * resource_info.ResourceRequirements {
@@ -160,7 +160,7 @@ func calcNextAllocationTestPodResources(previousTestResources, maxPodResources *
160160 return nPlus1Resources
161161}
162162
163- func (t * topologyPlugin ) getBestjobAllocateableDomains (job * podgroup_info.PodGroupInfo , topologyTree * TopologyInfo ) ([]* TopologyDomainInfo , error ) {
163+ func (t * topologyPlugin ) getBestJobAllocatableDomains (job * podgroup_info.PodGroupInfo , topologyTree * TopologyInfo ) ([]* TopologyDomainInfo , error ) {
164164 relevantLevels , err := t .calculateRelevantDomainLevels (job , topologyTree .Name , topologyTree )
165165 if err != nil {
166166 return nil , err
@@ -188,7 +188,7 @@ func (t *topologyPlugin) getBestjobAllocateableDomains(job *podgroup_info.PodGro
188188
189189 if job .PodGroup .Spec .TopologyConstraint .PreferredTopologyLevel != "" &&
190190 maxDepthDomains [0 ].Level != job .PodGroup .Spec .TopologyConstraint .PreferredTopologyLevel {
191- // If Preferred is defined and we couldn't find a domain on the prefered level,
191+ // If Preferred is defined and we couldn't find a domain on the preferred level,
192192 // return a children subset and not a single domain
193193 return t .improveChoiceForPreference (maxDepthDomains , job )
194194 }
@@ -227,12 +227,12 @@ func (*topologyPlugin) calculateRelevantDomainLevels(
227227 }
228228 }
229229 if requiredPlacement != "" && ! foundRequiredLevel {
230- return nil , fmt .Errorf ("the topology %s doesn't have a level matching the required(%s) spesified for the job %s" ,
230+ return nil , fmt .Errorf ("the topology %s doesn't have a level matching the required(%s) specified for the job %s" ,
231231 jobTopologyName , requiredPlacement , job .Name ,
232232 )
233233 }
234234 if preferredPlacement != "" && ! foundPreferredLevel {
235- return nil , fmt .Errorf ("the topology %s doesn't have a level matching the preffered (%s) spesified for the job %s" ,
235+ return nil , fmt .Errorf ("the topology %s doesn't have a level matching the preferred (%s) specified for the job %s" ,
236236 jobTopologyName , preferredPlacement , job .Name ,
237237 )
238238 }
@@ -245,33 +245,33 @@ func (t *topologyPlugin) improveChoiceForPreference(maxDepthDomains []*TopologyD
245245 // and return the one with the least number of domains required for the allocation
246246 bestChildrenSubset := []* TopologyDomainInfo {}
247247 for _ , domain := range maxDepthDomains {
248- childDomainSubset := getJobAllocateableChildrenSubset (domain , taskToAllocateCount )
248+ childDomainSubset := getJobAllocatableChildrenSubset (domain , taskToAllocateCount )
249249 if len (bestChildrenSubset ) == 0 || len (childDomainSubset ) < len (bestChildrenSubset ) {
250250 bestChildrenSubset = childDomainSubset
251251 }
252252 }
253253 return bestChildrenSubset , nil
254254}
255255
256- func getJobAllocateableChildrenSubset (domain * TopologyDomainInfo , taskToAllocateCount int ) []* TopologyDomainInfo {
256+ func getJobAllocatableChildrenSubset (domain * TopologyDomainInfo , taskToAllocateCount int ) []* TopologyDomainInfo {
257257 children := slices .Clone (domain .Children )
258258 sort .SliceStable (children , func (i , j int ) bool {
259259 return children [i ].AllocatablePods > children [j ].AllocatablePods
260260 })
261261
262- allocateablePodsSum := 0
262+ allocatablePodsSum := 0
263263 childDomainSubset := []* TopologyDomainInfo {}
264264 for _ , childDomain := range children {
265- allocateablePodsSum += childDomain .AllocatablePods
265+ allocatablePodsSum += childDomain .AllocatablePods
266266 childDomainSubset = append (childDomainSubset , childDomain )
267- if allocateablePodsSum >= taskToAllocateCount {
267+ if allocatablePodsSum >= taskToAllocateCount {
268268 break
269269 }
270270 }
271271 return childDomainSubset
272272}
273273
274- func (* topologyPlugin ) treeAllocateableCleanup (topologyTree * TopologyInfo ) {
274+ func (* topologyPlugin ) treeAllocatableCleanup (topologyTree * TopologyInfo ) {
275275 for _ , levelDomains := range topologyTree .DomainsByLevel {
276276 for _ , domain := range levelDomains {
277277 domain .AllocatablePods = 0
0 commit comments