types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PoolConfigDir = "/etc/cpu-pooler"

PoolConfigDir defines the pool configuration file location

Functions

This section is empty.

Types

type CPUAnnotation

type CPUAnnotation []Container

CPUAnnotation defines the pod cpu annotation structure

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) 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 string `yaml:"cpus"`
}

Pool defines cpupool

type PoolConfig

type PoolConfig struct {
	Pools        map[string]Pool   `yaml:"pools"`
	NodeSelector map[string]string `yaml:"nodeSelector"`
}

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