Documentation
¶
Index ¶
- Constants
- Variables
- func CreateBalloonsPolicy(policyOptions *policy.BackendOptions) policy.Backend
- func NewCpuTree(name string) *cpuTreeNode
- func NewCpuTreeFromSystem() (*cpuTreeNode, error)
- type Balloon
- type BalloonDef
- type BalloonMetrics
- type BalloonsOptions
- type CPUTopologyLevel
- type FillMethod
- type Metrics
Constants ¶
const ( // PolicyName is the name used to activate this policy. PolicyName = "balloons" // PolicyDescription is a short description of this policy. PolicyDescription = "Flexible pools with per-pool CPU parameters" // PolicyPath is the path of this policy in the configuration hierarchy. PolicyPath = "policy." + PolicyName // NoLimit value denotes no limit being set. NoLimit = 0 )
Variables ¶
var WalkSkipChildren error = errors.New("skip children")
WalkSkipChildren error returned from a DepthFirstWalk handler prevents walking deeper in the tree. The caller of the DepthFirstWalk will get no error.
var WalkStop error = errors.New("stop")
WalkStop error returned from a DepthFirstWalk handler stops the walk altogether. The caller of the DepthFirstWalk will get the WalkStop error.
Functions ¶
func CreateBalloonsPolicy ¶
func CreateBalloonsPolicy(policyOptions *policy.BackendOptions) policy.Backend
CreateBalloonsPolicy creates a new policy instance.
func NewCpuTree ¶
func NewCpuTree(name string) *cpuTreeNode
NewCpuTree returns a named CPU tree node.
func NewCpuTreeFromSystem ¶
func NewCpuTreeFromSystem() (*cpuTreeNode, error)
NewCpuTreeFromSystem returns the root node of the topology tree constructed from the underlying system.
Types ¶
type Balloon ¶
type Balloon struct {
// Def is the definition from which this balloon instance is created.
Def *BalloonDef
// Instance is the index of this balloon instance, starting from
// zero for every balloon definition.
Instance int
// Cpus is the set of CPUs exclusive to this balloon instance only.
Cpus cpuset.CPUSet
// Mems is the set of memory nodes with minimal access delay
// from CPUs.
Mems idset.IDSet
// balloon are allowed to use with workloads in other balloons
// that shareIdleCpus.
SharedIdleCpus cpuset.CPUSet
// PodIDs maps pod ID to list of container IDs.
// - len(PodIDs) is the number of pods in the balloon.
// - len(PodIDs[podID]) is the number of containers of podID
// currently assigned to the balloon.
PodIDs map[string][]string
}
Balloon contains attributes of a balloon instance
func (Balloon) AvailMilliCpus ¶
func (Balloon) ContainerCount ¶
ContainerCount returns the number of containers in a balloon.
func (Balloon) ContainerIDs ¶
ContainerIDs returns IDs of containers assigned in a balloon. (Using cache.Container.GetID()'s)
func (Balloon) PrettyName ¶
PrettyName returns a unique name for a balloon.
type BalloonDef ¶
type BalloonDef struct {
// Name of the balloon definition.
Name string `json:"Name"`
// Namespaces control which namespaces are assigned into
// balloon instances from this definition. This is used by
// namespace assign methods.
Namespaces []string `json:"Namespaces",omitempty`
// MaxCpus specifies the maximum number of CPUs exclusively
// usable by containers in a balloon. Balloon size will not be
// inflated larger than MaxCpus.
MaxCpus int `json:"MaxCPUs"`
// MinCpus specifies the minimum number of CPUs exclusively
// usable by containers in a balloon. When new balloon is created,
// this will be the number of CPUs reserved for it even if a container
// would request less.
MinCpus int `json:"MinCPUs"`
// AllocatorPriority (0: High, 1: Normal, 2: Low, 3: None)
// This parameter is passed to CPU allocator when creating or
// resizing a balloon. At init, balloons with highest priority
// CPUs are allocated first.
AllocatorPriority cpuallocator.CPUPriority `json:"AllocatorPriority"`
// CpuClass controls how CPUs of a balloon are (re)configured
// whenever a balloon is created, inflated or deflated.
CpuClass string `json:"CpuClass"`
// MinBalloons is the number of balloon instances that always
// exist even if they would become empty. At init this number
// of instances will be created before assigning any
// containers.
MinBalloons int `json:"MinBalloons"`
// MaxBalloons is the maximum number of balloon instances that
// is allowed to co-exist. If reached, new balloons cannot be
// created anymore.
MaxBalloons int `json:"MaxBalloons"`
// PreferSpreadingPods: containers of the same pod may be
// placed on separate balloons. The default is false: prefer
// placing containers of a pod to the same balloon(s).
PreferSpreadingPods bool
// PreferPerNamespaceBalloon: if true, containers in different
// namespaces are preferrably placed in separate balloons,
// even if the balloon type is the same for all of them. On
// the other hand, containers in the same namespace will be
// placed in the same balloon instances. The default is false:
// namespaces have no effect on placement.
PreferPerNamespaceBalloon bool
// PreferNewBalloons: prefer creating new balloons over adding
// containers to existing balloons. The default is false:
// prefer using filling free capacity and possibly inflating
// existing balloons before creating new ones.
PreferNewBalloons bool
// CPUs, that is CPUs not in any balloon, in the same
// <topology-level> as any CPU in the balloon, then allow
// workloads to run on those (shared) CPUs in addition to the
// (dedicated) CPUs of the balloon.
ShareIdleCpusInSame CPUTopologyLevel `json:"ShareIdleCPUsInSame,omitempty"`
}
BalloonDef contains a balloon definition.
func (*BalloonDef) DeepCopy ¶
func (bdef *BalloonDef) DeepCopy() *BalloonDef
DeepCopy creates a deep copy of a BalloonDef
type BalloonMetrics ¶
type BalloonMetrics struct {
// Balloon type metrics
DefName string
CpuClass string
MinCpus int
MaxCpus int
// Balloon instance metrics
PrettyName string
Cpus cpuset.CPUSet
CpusCount int
Numas []string
NumasCount int
Dies []string
DiesCount int
Packages []string
PackagesCount int
CpusAllowed cpuset.CPUSet
CpusAllowedCount int
Mems string
ContainerNames string
ContainerReqMilliCpus int
}
BalloonMetrics define metrics of a balloon instance.
type BalloonsOptions ¶
type BalloonsOptions balloonsOptionsWrapped
func (*BalloonsOptions) DeepCopy ¶
func (bo *BalloonsOptions) DeepCopy() *BalloonsOptions
DeepCopy creates a deep copy of a BalloonsOptions
func (*BalloonsOptions) UnmarshalJSON ¶
func (bo *BalloonsOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON makes sure all options from previous unmarshals get cleared before unmarshaling new data to the same address.
type CPUTopologyLevel ¶
type CPUTopologyLevel int
const ( CPUTopologyLevelUndefined CPUTopologyLevel = iota CPUTopologyLevelSystem CPUTopologyLevelPackage CPUTopologyLevelDie CPUTopologyLevelNuma CPUTopologyLevelCore CPUTopologyLevelThread CPUTopologyLevelCount )
func (CPUTopologyLevel) MarshalJSON ¶
func (ctl CPUTopologyLevel) MarshalJSON() ([]byte, error)
MarshalJSON()
func (CPUTopologyLevel) String ¶
func (ctl CPUTopologyLevel) String() string
Strings returns topology level as a string
func (*CPUTopologyLevel) UnmarshalJSON ¶
func (ctl *CPUTopologyLevel) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a JSON string to CPUTopologyLevel
type FillMethod ¶
type FillMethod int
FillMethod specifies the order in which balloon instances should be filled.
const ( FillUnspecified FillMethod = iota // FillBalanced: put a container into the balloon with most // free CPU without changing the size of the balloon. FillBalanced // FillBalancedInflate: put a container into the balloon with // most free CPU when the balloon is inflated to the maximum // size. FillBalancedInflate // FillPacked: put a container into a balloon so that it // minimizes the amount of currently unused CPUs in the // balloon. FillPacked // FillPackedInflate: put a container into a balloon so that // it minimizes the amount of unused CPUs if the balloon is // inflated to the maximum size. FillPackedInflate // FillSameNamespace: put a container into a balloon that already // includes another container from the same namespace FillSameNamespace // FillSamePod: put a container into a balloon that already // includes another container from the same pod. FillSamePod // FillNewBalloon: create a new balloon, if possible, and put // a container into it. FillNewBalloon // FillNewBalloonMust: create a new balloon for a container, // but refuse to run the container if the balloon cannot be // created. FillNewBalloonMust // FillReservedBalloon: put a container into the reserved // balloon. FillReservedBalloon // FillDefaultBalloon: put a container into the default // balloon. FillDefaultBalloon )
func (FillMethod) MarshalJSON ¶
func (fm FillMethod) MarshalJSON() ([]byte, error)
MarshalJSON marshals a FillMethod as a quoted json string
func (*FillMethod) UnmarshalJSON ¶
func (fm *FillMethod) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals a FillMethod quoted json string to the enum value
type Metrics ¶
type Metrics struct {
Balloons []*BalloonMetrics
}
Metrics defines the balloons-specific metrics from policy level.