in pkg/workload/workload.go [130:159]
func totalRequestsFromAdmission(wl *kueue.Workload) []PodSetResources {
if wl.Status.Admission == nil {
return nil
}
res := make([]PodSetResources, 0, len(wl.Spec.PodSets))
currentCounts := podSetsCountsAfterReclaim(wl)
totalCounts := podSetsCounts(wl)
for _, psa := range wl.Status.Admission.PodSetAssignments {
setRes := PodSetResources{
Name: psa.Name,
Flavors: psa.Flavors,
Count: psa.Count,
Requests: newRequests(psa.ResourceUsage),
}
if psa.Count == 0 {
// this can happen if the operator version is changed while the workload is admitted
setRes.Count = totalCounts[psa.Name]
}
if count := currentCounts[psa.Name]; count != psa.Count {
setRes.Requests.scaleDown(int64(setRes.Count))
setRes.Requests.scaleUp(int64(count))
setRes.Count = count
}
res = append(res, setRes)
}
return res
}