func cmp2()

in pkg/capacityscheduling/elasticquota.go [196:224]


func cmp2(x1, x2, y *framework.Resource, bound int64) bool {
	if x1.MilliCPU+x2.MilliCPU > y.MilliCPU {
		return true
	}

	if x1.Memory+x2.Memory > y.Memory {
		return true
	}

	if x1.EphemeralStorage+x2.EphemeralStorage > y.EphemeralStorage {
		return true
	}

	if x1.AllowedPodNumber+x2.AllowedPodNumber > y.AllowedPodNumber {
		return true
	}

	for rName, rQuant := range x1.ScalarResources {
		yQuant := bound
		if yq, ok := y.ScalarResources[rName]; ok {
			yQuant = yq
		}
		if rQuant+x2.ScalarResources[rName] > yQuant {
			return true
		}
	}

	return false
}