in pkg/noderesources/resource_allocation.go [104:128]
func calculatePodResourceRequest(pod *v1.Pod, resource v1.ResourceName) int64 {
var podRequest int64
for i := range pod.Spec.Containers {
container := &pod.Spec.Containers[i]
qty := schedutil.GetRequestForResource(resource, &container.Resources.Requests, true)
podRequest += qty.Value()
}
for i := range pod.Spec.InitContainers {
initContainer := &pod.Spec.InitContainers[i]
qty := schedutil.GetRequestForResource(resource, &initContainer.Resources.Requests, true)
if value := qty.Value(); podRequest < value {
podRequest = value
}
}
// If Overhead is being utilized, add to the total requests for the pod
if pod.Spec.Overhead != nil {
if quantity, found := pod.Spec.Overhead[resource]; found {
podRequest += quantity.Value()
}
}
return podRequest
}