types

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//SharedPoolID is the constant prefix in the name of the CPU pool. It is used to signal that a CPU pool is of shared type
	SharedPoolID = "shared"
	//ExclusivePoolID is the constant prefix in the name of the CPU pool. It is used to signal that a CPU pool is of exclusive type
	ExclusivePoolID = "exclusive"
	//DefaultPoolID is the constant prefix in the name of the CPU pool. It is used to signal that a CPU pool is of default type
	DefaultPoolID = "default"
)

Variables

View Source
var (
	//PoolConfigDir defines the pool configuration file location
	PoolConfigDir = "/etc/cpu-pooler"
)

Functions

func DeterminePoolType added in v0.3.0

func DeterminePoolType(poolName string) string

DeterminePoolType takes the name of CPU pool as defined in the CPU-Pooler ConfigMap, and returns the type of CPU pool it represents. Type of the pool is determined based on the constant prefixes used in the name of the pool. A type can be shared, exclusive, or default.

Types

type CPUAnnotation

type CPUAnnotation map[string]Container

CPUAnnotation defines the pod cpu annotation structure

func NewCPUAnnotation added in v0.3.1

func NewCPUAnnotation() CPUAnnotation

NewCPUAnnotation returns a new CPUAnnotation

func (CPUAnnotation) ContainerExclusiveCPU

func (cpuAnnotation CPUAnnotation) ContainerExclusiveCPU(container string) int

ContainerExclusiveCPU returns sum of cpu time requested from exclusive pool by a container

func (CPUAnnotation) ContainerExists added in v0.3.1

func (cpuAnnotation CPUAnnotation) ContainerExists(name string) bool

ContainerExists tells if container exist in annotation

func (CPUAnnotation) ContainerPools

func (cpuAnnotation CPUAnnotation) ContainerPools(cName string) (pools []string)

ContainerPools returns all pools configured for container

func (CPUAnnotation) ContainerSharedCPUTime

func (cpuAnnotation CPUAnnotation) ContainerSharedCPUTime(container string) int

ContainerSharedCPUTime returns sum of cpu time requested from shared pool by a container

func (CPUAnnotation) ContainerTotalCPURequest

func (cpuAnnotation CPUAnnotation) ContainerTotalCPURequest(pool string, cName string) int

ContainerTotalCPURequest returns CPU requests of container from pool

func (CPUAnnotation) Containers

func (cpuAnnotation CPUAnnotation) Containers() []string

Containers returns container name string in annotation

func (CPUAnnotation) Decode

func (cpuAnnotation CPUAnnotation) Decode(annotation []byte) error

Decode unmarshals json annotation to CPUAnnotation

type Container

type Container struct {
	Name      string    `json:"container"`
	Processes []Process `json:"processes"`
}

Container idenfifies container and defines the processes to be started

type Pool

type Pool struct {
	CPUs cpuset.CPUSet
}

Pool defines cpupool

type PoolConfig

type PoolConfig struct {
	Pools        map[string]Pool
	NodeSelector map[string]string
}

PoolConfig defines pool configuration for a node

func DeterminePoolConfig

func DeterminePoolConfig() (PoolConfig, string, error)

DeterminePoolConfig first interrogates the label set of the Node this process runs on. It uses this information to select the specific PoolConfig file corresponding to the Node. Returns the selected PoolConfig file, the name of the file, or an error if it was impossible to determine which config file is applicable.

func ReadPoolConfigFile

func ReadPoolConfigFile(name string) (PoolConfig, error)

ReadPoolConfigFile reads a pool configuration file

func (PoolConfig) SelectPool

func (poolConf PoolConfig) SelectPool(prefix string) Pool

SelectPool returns the exact CPUSet belonging to either the exclusive, shared, or default pool of one PoolConfig object An empty CPUSet is returned in case the configuration does not contain the requested type

type Process

type Process struct {
	ProcName string   `json:"process"`
	Args     []string `json:"args"`
	CPUs     int      `json:"cpus"`
	PoolName string   `json:"pool"`
}

Process defines process information in pod annotation The information is used for setting CPU affinity

Jump to

Keyboard shortcuts

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