pool

package
v0.0.0-...-a3a9308 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourcePrefix = "intel.com/cpupool." // prefix for CPU pool resources
	IgnoredPool    = "ignored"            // CPUs we have to ignore
	OfflinePool    = "offline"            // CPUs which are offline
	ReservedPool   = "reserved"           // CPUs reserved for kube and system
	DefaultPool    = "default"            // CPUs in the default set
)

Variables

This section is empty.

Functions

func GetContainerPoolResources

func GetContainerPoolResources(p *v1.Pod, c *v1.Container) (string, int64, int64)

Get the CPU pool, request, and limit of a container.

Types

type AllocCPUFunc

type AllocCPUFunc func(*topology.CPUTopology, cpuset.CPUSet, int) (cpuset.CPUSet, error)

A CPU allocator function.

type CPUFlags

type CPUFlags int

CPUFlags has the CPU allocation flags

const (
	AllocShared    CPUFlags = 0x00 // allocate to shared set in pool
	AllocExclusive CPUFlags = 0x01 // allocate exclusively in pool
	KubePinned     CPUFlags = 0x00 // we take care of CPU pinning
	WorkloadPinned CPUFlags = 0x02 // workload takes care of CPU pinning
	DefaultFlags   CPUFlags = AllocShared | KubePinned
)

type Config

type Config struct {
	Size int            `json:"size"`           // number of CPUs to allocate
	Cpus *cpuset.CPUSet `json:"cpus,omitempty"` // explicit CPUs to allocate, if given
}

Configuration for a single CPU pool.

func (*Config) String

func (cfg *Config) String() string

Dump a configuration as a string.

type Container

type Container struct {
	// contains filtered or unexported fields
}

A container assigned to run in a pool.

func (Container) MarshalJSON

func (pc Container) MarshalJSON() ([]byte, error)

func (*Container) UnmarshalJSON

func (pc *Container) UnmarshalJSON(b []byte) error

type NodeConfig

type NodeConfig map[string]*Config

Node CPU pool configuration.

func DefaultNodeConfig

func DefaultNodeConfig(numReservedCPUs int, cpuPoolConfig map[string]string) (NodeConfig, error)

Create default node CPU pool configuration.

func ParseNodeConfig

func ParseNodeConfig(numReservedCPUs int, confpath string) (NodeConfig, error)

func (NodeConfig) String

func (nc NodeConfig) String() string

Dump node CPU pool configuration as string.

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

A CPU pool is a set of cores, typically set aside for a class of workloads.

func (Pool) MarshalJSON

func (p Pool) MarshalJSON() ([]byte, error)

func (*Pool) String

func (p *Pool) String() string

Dump a pool as a string.

func (*Pool) UnmarshalJSON

func (p *Pool) UnmarshalJSON(b []byte) error

type PoolSet

type PoolSet struct {
	// contains filtered or unexported fields
}

All pools available for kube on this node.

func NewPoolSet

func NewPoolSet(cfg NodeConfig, stats *statistics.Stat) (*PoolSet, error)

Create a new CPU pool set with the given configuration.

func (*PoolSet) AllocateCPU

func (ps *PoolSet) AllocateCPU(id string, pool string, req int64) (cpuset.CPUSet, error)

Allocate CPU for a container from a pool.

func (*PoolSet) AllocateCPUs

func (ps *PoolSet) AllocateCPUs(id string, pool string, numCPUs int) (cpuset.CPUSet, error)

Allocate a number of CPUs exclusively from a pool.

func (*PoolSet) GetCPUAssignments

func (ps *PoolSet) GetCPUAssignments() map[string]cpuset.CPUSet

Get the exclusive CPU assignments as ContainerCPUAssignments.

func (*PoolSet) GetContainerCPUSet

func (ps *PoolSet) GetContainerCPUSet(id string) (cpuset.CPUSet, bool)

Get the CPU allocations for a container.

func (*PoolSet) GetContainerPoolName

func (ps *PoolSet) GetContainerPoolName(id string) string

Get the name of the CPU pool a container is assigned to.

func (*PoolSet) GetPoolAssignments

func (ps *PoolSet) GetPoolAssignments(exclusive bool) map[string]cpuset.CPUSet

Get the exclusively allocated CPU sets.

func (*PoolSet) GetPoolCPUSet

func (ps *PoolSet) GetPoolCPUSet(pool string) (cpuset.CPUSet, bool)

Get the shared CPUs of a pool.

func (*PoolSet) GetPoolCPUs

func (ps *PoolSet) GetPoolCPUs() map[string]cpuset.CPUSet

Get the (shared) CPU sets for pools.

func (*PoolSet) GetPoolCapacity

func (ps *PoolSet) GetPoolCapacity() v1.ResourceList

Get the CPU capacity of pools.

func (PoolSet) MarshalJSON

func (ps PoolSet) MarshalJSON() ([]byte, error)

func (*PoolSet) ReconcileConfig

func (ps *PoolSet) ReconcileConfig() error

Run one round of reconcilation of the CPU pool set configuration.

func (*PoolSet) Reconfigure

func (ps *PoolSet) Reconfigure(cfg NodeConfig) error

Reconfigure the CPU pool set.

func (*PoolSet) ReleaseCPU

func (ps *PoolSet) ReleaseCPU(id string)

Return CPU from a container to a pool.

func (*PoolSet) SetAllocator

func (ps *PoolSet) SetAllocator(allocfn AllocCPUFunc, topo *topology.CPUTopology)

Set the CPU allocator function, and CPU topology information.

func (*PoolSet) UnmarshalJSON

func (ps *PoolSet) UnmarshalJSON(b []byte) error

func (*PoolSet) Verify

func (ps *PoolSet) Verify() error

Verify the current pool state.

Jump to

Keyboard shortcuts

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