scheduler

package
v1.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resource

type Resource struct {
	MilliCPU int64
	Memory   int64
}

Resource is a collection of compute resource.

func ComputePodResourceRequest

func ComputePodResourceRequest(pod *v1.Pod) *Resource

ComputePodResourceRequest returns a framework.Resource that covers the largest width in each resource dimension. Because init-containers run sequentially, we collect the max in each dimension iteratively. In contrast, we sum the resource vectors for regular containers since they run simultaneously.

If Pod Overhead is specified, the resources defined for Overhead are added to the calculated Resource request sum

Example:

Pod:

InitContainers
  IC1:
    CPU: 2
    Memory: 1G
  IC2:
    CPU: 2
    Memory: 3G
Containers
  C1:
    CPU: 2
    Memory: 1G
  C2:
    CPU: 1
    Memory: 1G

Result: CPU: 3, Memory: 3G

func NewEmptyResource added in v1.13.2

func NewEmptyResource() Resource

func NewResource added in v1.13.2

func NewResource(cpu int64, memory int64) Resource

func (*Resource) Add

func (r *Resource) Add(rl v1.ResourceList)

Add adds ResourceList into Resource.

func (*Resource) GetCPUQuantity added in v1.13.2

func (r *Resource) GetCPUQuantity() *resource.Quantity

func (*Resource) GetMemoryQuantity added in v1.13.2

func (r *Resource) GetMemoryQuantity() *resource.Quantity

func (*Resource) IsEmpty added in v1.13.2

func (r *Resource) IsEmpty() bool

func (*Resource) SetMaxResource

func (r *Resource) SetMaxResource(rl v1.ResourceList)

SetMaxResource compares with ResourceList and takes max value for each Resource.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL