Documentation ¶
Index ¶
- func PodRequestsAndLimits(pod *v1.Pod) (reqs, limits v1.ResourceList)
- func PodRequestsAndLimitsReuse(pod *v1.Pod, reuseReqs, reuseLimits v1.ResourceList) (reqs, limits v1.ResourceList)
- func PodRequestsAndLimitsWithoutOverhead(pod *v1.Pod) (reqs, limits v1.ResourceList)
- type CustomResources
- type ProviderNode
- type Resource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PodRequestsAndLimits ¶
func PodRequestsAndLimits(pod *v1.Pod) (reqs, limits v1.ResourceList)
PodRequestsAndLimits returns a dictionary of all defined resources summed up for all containers of the pod. If PodOverhead feature is enabled, pod overhead is added to the total container resource requests and to the total container limits which have a non-zero quantity.
func PodRequestsAndLimitsReuse ¶
func PodRequestsAndLimitsReuse(pod *v1.Pod, reuseReqs, reuseLimits v1.ResourceList) (reqs, limits v1.ResourceList)
PodRequestsAndLimitsReuse returns a dictionary of all defined resources summed up for all containers of the pod. If PodOverhead feature is enabled, pod overhead is added to the total container resource requests and to the total container limits which have a non-zero quantity. The caller may avoid allocations of resource lists by passing a requests and limits list to the function, which will be cleared before use.
func PodRequestsAndLimitsWithoutOverhead ¶
func PodRequestsAndLimitsWithoutOverhead(pod *v1.Pod) (reqs, limits v1.ResourceList)
PodRequestsAndLimitsWithoutOverhead will create a dictionary of all defined resources summed up for all containers of the pod.
Types ¶
type CustomResources ¶
type CustomResources map[corev1.ResourceName]resource.Quantity
CustomResources is a key-value map for defining custom resources
func (CustomResources) DeepCopy ¶
func (cr CustomResources) DeepCopy() CustomResources
DeepCopy copy the custom resource
func (CustomResources) Equal ¶
func (cr CustomResources) Equal(other CustomResources) bool
Equal return if resources is equal
type ProviderNode ¶
func (*ProviderNode) AddResource ¶
func (n *ProviderNode) AddResource(resource *Resource) error
AddResource add resource to the node
func (*ProviderNode) DeepCopy ¶
func (n *ProviderNode) DeepCopy() *corev1.Node
DeepCopy deepcopy node with lock, to avoid concurrent read-write
func (*ProviderNode) SubResource ¶
func (n *ProviderNode) SubResource(resource *Resource) error
SubResource sub resource from the node
type Resource ¶
type Resource struct { // CPU requirement CPU resource.Quantity // Memory requirement Memory resource.Quantity // Pods requirement Pods resource.Quantity // EphemeralStorage requirement EphemeralStorage resource.Quantity // Custom resource requirement Custom CustomResources }
Resource defines the resources of a pod, it provides func `Add`, `Sub` to make computation flexible
func ConvertResource ¶
func ConvertResource(resources corev1.ResourceList) *Resource
ConvertResource converts ResourceList to Resource
func (*Resource) SetCapacityToNode ¶
SetCapacityToNode set the resource the virtual-kubelet node