Documentation ¶
Index ¶
- Constants
- func GetContainerPoolResources(p *v1.Pod, c *v1.Container) (string, int64, int64)
- type AllocCPUFunc
- type CPUFlags
- type Config
- type Container
- type NodeConfig
- type Pool
- type PoolSet
- func (ps *PoolSet) AllocateCPU(id string, pool string, req int64) (cpuset.CPUSet, error)
- func (ps *PoolSet) AllocateCPUs(id string, pool string, numCPUs int) (cpuset.CPUSet, error)
- func (ps *PoolSet) GetCPUAssignments() map[string]cpuset.CPUSet
- func (ps *PoolSet) GetContainerCPUSet(id string) (cpuset.CPUSet, bool)
- func (ps *PoolSet) GetContainerPoolName(id string) string
- func (ps *PoolSet) GetPoolAssignments(exclusive bool) map[string]cpuset.CPUSet
- func (ps *PoolSet) GetPoolCPUSet(pool string) (cpuset.CPUSet, bool)
- func (ps *PoolSet) GetPoolCPUs() map[string]cpuset.CPUSet
- func (ps *PoolSet) GetPoolCapacity() v1.ResourceList
- func (ps PoolSet) MarshalJSON() ([]byte, error)
- func (ps *PoolSet) ReconcileConfig() error
- func (ps *PoolSet) Reconfigure(cfg NodeConfig) error
- func (ps *PoolSet) ReleaseCPU(id string)
- func (ps *PoolSet) SetAllocator(allocfn AllocCPUFunc, topo *topology.CPUTopology)
- func (ps *PoolSet) UnmarshalJSON(b []byte) error
- func (ps *PoolSet) Verify() error
Constants ¶
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 ¶
Types ¶
type AllocCPUFunc ¶
A CPU allocator function.
type CPUFlags ¶
type CPUFlags int
CPUFlags has the CPU allocation flags
const ( 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.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
A container assigned to run in a pool.
func (Container) MarshalJSON ¶
func (*Container) UnmarshalJSON ¶
type NodeConfig ¶
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 (*Pool) UnmarshalJSON ¶
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 ¶
Allocate CPU for a container from a pool.
func (*PoolSet) AllocateCPUs ¶
Allocate a number of CPUs exclusively from a pool.
func (*PoolSet) GetCPUAssignments ¶
Get the exclusive CPU assignments as ContainerCPUAssignments.
func (*PoolSet) GetContainerCPUSet ¶
Get the CPU allocations for a container.
func (*PoolSet) GetContainerPoolName ¶
Get the name of the CPU pool a container is assigned to.
func (*PoolSet) GetPoolAssignments ¶
Get the exclusively allocated CPU sets.
func (*PoolSet) GetPoolCPUSet ¶
Get the shared CPUs of a pool.
func (*PoolSet) GetPoolCPUs ¶
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 (*PoolSet) ReconcileConfig ¶
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 ¶
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.