func findFlavorForResource(
	log logr.Logger,
	name corev1.ResourceName,
	val int64,
	wUsed map[string]int64,
	cq *cache.ClusterQueue,
	spec *corev1.PodSpec) (string, int64) {
	// We will only check against the flavors' labels for the resource.
	selector := flavorSelector(spec, cq.LabelKeys[name])
	for _, flavor := range cq.RequestableResources[name] {
		_, untolerated := corev1helpers.FindMatchingUntoleratedTaint(flavor.Taints, spec.Tolerations, func(t *corev1.Taint) bool {
			return t.Effect == corev1.TaintEffectNoSchedule || t.Effect == corev1.TaintEffectNoExecute
		})
		if untolerated {
			continue
		}
		if match, err := selector.Match(&corev1.Node{ObjectMeta: metav1.ObjectMeta{Labels: flavor.Labels}}); !match || err != nil {
			if err != nil {
				log.Error(err, "Matching workload affinity against flavor; no flavor assigned")
				return "", 0
			}
			continue
		}

		// Check considering the flavor usage by previous pod sets.
		ok, borrow := fitsFlavorLimits(name, val+wUsed[flavor.Name], cq, &flavor)
		if ok {
			return flavor.Name, borrow
		}
	}
	return "", 0
}
// findFlavorForResources returns a flavor which can satisfy the resource request,
// given that wUsed is the usage of flavors by previous podsets.
// If it finds a flavor, also returns any borrowing required.
findFlavorForResources returns a flavor which can satisfy the resource request,
given that wUsed is the usage of flavors by previous podsets.
If it finds a flavor, also returns any borrowing required.
// findFlavorForResources returns a flavor which can satisfy the resource request // given that wUsed is the usage of flavors by previous podsets . // If it finds a flavor also returns any borrowing required .
func findFlavorForResource(
	log logr.Logger,
	name corev1.ResourceName,
	val int64,
	wUsed map[string]int64,
	cq *cache.ClusterQueue,
	spec *corev1.PodSpec) (string, int64) {
	selector := flavorSelector(spec, cq.LabelKeys[name])
	for _, flavor := range cq.RequestableResources[name] {
		_, untolerated := corev1helpers.FindMatchingUntoleratedTaint(flavor.Taints, spec.Tolerations, func(t *corev1.Taint) bool {
			return t.Effect == corev1.TaintEffectNoSchedule || t.Effect == corev1.TaintEffectNoExecute
		})
		if untolerated {
			continue
		}
		if match, err := selector.Match(&corev1.Node{ObjectMeta: metav1.ObjectMeta{Labels: flavor.Labels}}); !match || err != nil {
			if err != nil {
				log.Error(err, "Matching workload affinity against flavor; no flavor assigned")
				return "", 0
			}
			continue
		}
		ok, borrow := fitsFlavorLimits(name, val+wUsed[flavor.Name], cq, &flavor)
		if ok {
			return flavor.Name, borrow
		}
	}
	return "", 0
}
func findFlavorForResource ( log logr . Logger , name corev1 . ResourceName , val int64 , wUsed map [ string ] int64 , cq * cache . ClusterQueue , spec * corev1 . PodSpec ) ( string , int64 ) { selector := flavorSelector ( spec , cq . LabelKeys [ name ] ) for _ , flavor := range cq . RequestableResources [ name ] { _ , untolerated := corev1helpers . FindMatchingUntoleratedTaint ( flavor . Taints , spec . Tolerations , func ( t * corev1 . Taint ) bool { return t . Effect == corev1 . TaintEffectNoSchedule || t . Effect == corev1 . TaintEffectNoExecute } ) if untolerated { continue } if match , err := selector . Match ( & corev1 . Node { ObjectMeta : metav1 . ObjectMeta { Labels : flavor . Labels } } ) ; ! match || err != nil { if err != nil { log . Error ( err , " " ) return " " , 0 } continue } ok , borrow := fitsFlavorLimits ( name , val + wUsed [ flavor . Name ] , cq , & flavor ) if ok { return flavor . Name , borrow } } return " " , 0 }
findFlavorForResources returns a flavor which can satisfy the resource request,
given that wUsed is the usage of flavors by previous podsets.
findFlavorForResources returns a flavor which can satisfy the resource request given that wUsed is the usage of flavors by previous podsets .
// We will only check against the flavors' labels for the resource. // Check considering the flavor usage by previous pod sets.