func (e *entry) assignFlavors(log logr.Logger, cq *cache.ClusterQueue) bool {
	flavoredRequests := make([]workload.PodSetResources, 0, len(e.TotalRequests))
	wUsed := make(cache.Resources)
	wBorrows := make(cache.Resources)
	for i, podSet := range e.TotalRequests {
		flavors := make(map[corev1.ResourceName]string, len(podSet.Requests))
		for resName, reqVal := range podSet.Requests {
			rFlavor, borrow := findFlavorForResource(log, resName, reqVal, wUsed[resName], cq, &e.Obj.Spec.PodSets[i].Spec)
			if rFlavor == "" {
				return false
			}
			if borrow > 0 {
				if wBorrows[resName] == nil {
					wBorrows[resName] = make(map[string]int64)
				}
				// Don't accumulate borrowing. The returned `borrow` already considers
				// usage from previous pod sets.
				wBorrows[resName][rFlavor] = borrow
			}
			if wUsed[resName] == nil {
				wUsed[resName] = make(map[string]int64)
			}
			wUsed[resName][rFlavor] += reqVal
			flavors[resName] = rFlavor
		}
		flavoredRequests = append(flavoredRequests, workload.PodSetResources{
			Name:     podSet.Name,
			Requests: podSet.Requests,
			Flavors:  flavors,
		})
	}
	e.TotalRequests = flavoredRequests
	if len(wBorrows) > 0 {
		e.borrows = wBorrows
	}
	return true
}
// assignFlavors calculates the flavors that should be assigned to this entry
// if admitted by this clusterQueue, including details of how much it needs to
// borrow from the cohort.
// It returns whether the entry would fit. If it doesn't fit, the object is
// unmodified.
assignFlavors calculates the flavors that should be assigned to this entry
if admitted by this clusterQueue, including details of how much it needs to
borrow from the cohort.
It returns whether the entry would fit. If it doesn't fit, the object is
unmodified.
// assignFlavors calculates the flavors that should be assigned to this entry // if admitted by this clusterQueue including details of how much it needs to // borrow from the cohort . // It returns whether the entry would fit . If it doesn ' t fit the object is // unmodified .
func (e *entry) assignFlavors(log logr.Logger, cq *cache.ClusterQueue) bool {
	flavoredRequests := make([]workload.PodSetResources, 0, len(e.TotalRequests))
	wUsed := make(cache.Resources)
	wBorrows := make(cache.Resources)
	for i, podSet := range e.TotalRequests {
		flavors := make(map[corev1.ResourceName]string, len(podSet.Requests))
		for resName, reqVal := range podSet.Requests {
			rFlavor, borrow := findFlavorForResource(log, resName, reqVal, wUsed[resName], cq, &e.Obj.Spec.PodSets[i].Spec)
			if rFlavor == "" {
				return false
			}
			if borrow > 0 {
				if wBorrows[resName] == nil {
					wBorrows[resName] = make(map[string]int64)
				}
				wBorrows[resName][rFlavor] = borrow
			}
			if wUsed[resName] == nil {
				wUsed[resName] = make(map[string]int64)
			}
			wUsed[resName][rFlavor] += reqVal
			flavors[resName] = rFlavor
		}
		flavoredRequests = append(flavoredRequests, workload.PodSetResources{
			Name:     podSet.Name,
			Requests: podSet.Requests,
			Flavors:  flavors,
		})
	}
	e.TotalRequests = flavoredRequests
	if len(wBorrows) > 0 {
		e.borrows = wBorrows
	}
	return true
}
func ( e * entry ) assignFlavors ( log logr . Logger , cq * cache . ClusterQueue ) bool { flavoredRequests := make ( [ ] workload . PodSetResources , 0 , len ( e . TotalRequests ) ) wUsed := make ( cache . Resources ) wBorrows := make ( cache . Resources ) for i , podSet := range e . TotalRequests { flavors := make ( map [ corev1 . ResourceName ] string , len ( podSet . Requests ) ) for resName , reqVal := range podSet . Requests { rFlavor , borrow := findFlavorForResource ( log , resName , reqVal , wUsed [ resName ] , cq , & e . Obj . Spec . PodSets [ i ] . Spec ) if rFlavor == " " { return false } if borrow > 0 { if wBorrows [ resName ] == nil { wBorrows [ resName ] = make ( map [ string ] int64 ) } wBorrows [ resName ] [ rFlavor ] = borrow } if wUsed [ resName ] == nil { wUsed [ resName ] = make ( map [ string ] int64 ) } wUsed [ resName ] [ rFlavor ] += reqVal flavors [ resName ] = rFlavor } flavoredRequests = append ( flavoredRequests , workload . PodSetResources { Name : podSet . Name , Requests : podSet . Requests , Flavors : flavors , } ) } e . TotalRequests = flavoredRequests if len ( wBorrows ) > 0 { e . borrows = wBorrows } return true }
assignFlavors calculates the flavors that should be assigned to this entry
if admitted by this clusterQueue, including details of how much it needs to
borrow from the cohort.
assignFlavors calculates the flavors that should be assigned to this entry if admitted by this clusterQueue including details of how much it needs to borrow from the cohort .
// Don't accumulate borrowing. The returned `borrow` already considers // usage from previous pod sets.