// PodRequestsAndLimits returns a dictionary of all defined resources summed up for all // containers of the pod. If pod overhead is non-nil, the pod overhead is added to the // total container resource requests and to the total container limits which have a // non-zero quantity. func PodRequestsAndLimits(pod *corev1.Pod) (reqs, limits corev1.ResourceList) { … } // podRequests is a simplified form of PodRequests from k8s.io/kubernetes/pkg/api/v1/resource that doesn't check // feature gate enablement and avoids adding a dependency on k8s.io/kubernetes/pkg/apis/core/v1 for kubectl. func podRequests(pod *corev1.Pod) corev1.ResourceList { … } // podLimits is a simplified form of PodLimits from k8s.io/kubernetes/pkg/api/v1/resource that doesn't check // feature gate enablement and avoids adding a dependency on k8s.io/kubernetes/pkg/apis/core/v1 for kubectl. func podLimits(pod *corev1.Pod) corev1.ResourceList { … } // max returns the result of max(a, b) for each named resource and is only used if we can't // accumulate into an existing resource list func max(a corev1.ResourceList, b corev1.ResourceList) corev1.ResourceList { … } // addResourceList adds the resources in newList to list func addResourceList(list, new corev1.ResourceList) { … } // maxResourceList sets list to the greater of list/newList for every resource // either list func maxResourceList(list, new corev1.ResourceList) { … } // ExtractContainerResourceValue extracts the value of a resource // in an already known container func ExtractContainerResourceValue(fs *corev1.ResourceFieldSelector, container *corev1.Container) (string, error) { … } // convertResourceCPUToString converts cpu value to the format of divisor and returns // ceiling of the value. func convertResourceCPUToString(cpu *resource.Quantity, divisor resource.Quantity) (string, error) { … } // convertResourceMemoryToString converts memory value to the format of divisor and returns // ceiling of the value. func convertResourceMemoryToString(memory *resource.Quantity, divisor resource.Quantity) (string, error) { … } // convertResourceHugePagesToString converts hugepages value to the format of divisor and returns // ceiling of the value. func convertResourceHugePagesToString(hugePages *resource.Quantity, divisor resource.Quantity) (string, error) { … } // convertResourceEphemeralStorageToString converts ephemeral storage value to the format of divisor and returns // ceiling of the value. func convertResourceEphemeralStorageToString(ephemeralStorage *resource.Quantity, divisor resource.Quantity) (string, error) { … } var standardContainerResources … // IsStandardContainerResourceName returns true if the container can make a resource request // for the specified resource func IsStandardContainerResourceName(str string) bool { … } // IsHugePageResourceName returns true if the resource name has the huge page // resource prefix. func IsHugePageResourceName(name corev1.ResourceName) bool { … }