func IsExclusive()

in pkg/noderesourcetopology/resourcerequests/exclusive.go [59:81]


func IsExclusive(qos corev1.PodQOSClass, resource corev1.ResourceName, quantity resource.Quantity) bool {
	// devices accessed via device plugins are non-shareable
	// note until we reach better clarity we treat extended resources as devices
	if !v1helper.IsNativeResource(resource) {
		return true
	}
	if qos != corev1.PodQOSGuaranteed {
		// nothing more we can check, bail out ASAP
		return false
	}
	if resource == corev1.ResourceCPU {
		// integral CPU quantity == exclusive CPU
		if (quantity.Value()*1000 == quantity.MilliValue()) && quantity.Value() > 0 {
			return true
		}
	}
	if resource == corev1.ResourceMemory || v1helper.IsHugePageResourceName(resource) {
		if quantity.Value() > 0 {
			return true
		}
	}
	return false
}