types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 23

Documentation

Index

Constants

View Source
const (
	ReservedForReclaim = 4

	MinShareCPURequirement     = 4
	MinDedicatedCPURequirement = 4

	MaxRampUpStep     = 10
	MaxRampDownStep   = 2
	MinRampDownPeriod = 30 * time.Second
	StartUpPeriod     = 30 * time.Second

	ReclaimUsageMarginForOverlap = 6
)

consts for cpu provision

View Source
const (
	// BoundUpper indicates reaching resource upper bound, with highest priority
	BoundUpper     BoundType = "upper"
	BoundUpperCode int       = 0

	// BoundLower indicates reaching resource lower bound
	BoundLower     BoundType = "lower"
	BoundLowerCode int       = 1

	// BoundNone indicates between resource upper and lower bound
	BoundNone     BoundType = "none"
	BoundNoneCode int       = 2

	// BoundUnknown indicates unknown bound status
	BoundUnknown     BoundType = "unknown"
	BoundUnknownCode int       = 3
)
View Source
const (
	MemoryPressureNoRisk    MemoryPressureState = 0
	MemoryPressureTuneMemCg MemoryPressureState = 1
	MemoryPressureDropCache MemoryPressureState = 2

	MemoryHeadroomPolicyNone      MemoryHeadroomPolicyName = "none"
	MemoryHeadroomPolicyCanonical MemoryHeadroomPolicyName = "canonical"
	MemoryHeadroomPolicyNUMAAware MemoryHeadroomPolicyName = "numa-aware"

	MemoryProvisionPolicyNone      MemoryProvisionPolicyName = "none"
	MemoryProvisionPolicyCanonical MemoryProvisionPolicyName = "canonical"
)
View Source
const (
	HeadroomReporter   = "headroom_reporter"
	NodeMetricReporter = "node_metric_reporter"
)
View Source
const (
	AdvisorPluginNameQoSAware        = "qos_aware"
	AdvisorPluginNameMetaCache       = "metacache"
	AdvisorPluginNameMetricEmitter   = "metric_emitter"
	AdvisorPluginNameInference       = "inference"
	AdvisorPluginNameOvercommitAware = "overcommit_aware"
)
View Source
const (
	InvalidHeadroom = -1
)
View Source
const (
	RegionNameSeparator = "-"
)

Variables

View Source
var BoundTypeCodeMap = map[BoundType]int{
	BoundUpper:   BoundUpperCode,
	BoundLower:   BoundLowerCode,
	BoundNone:    BoundNoneCode,
	BoundUnknown: BoundUnknownCode,
}
View Source
var (
	InvalidControlKnob = map[ControlKnobName]ControlKnobValue{"": {}}
)

Functions

func NewContainerSourceImpList added in v0.3.0

func NewContainerSourceImpList(containers []*ContainerInfo) general.SourceList

Types

type BoundType added in v0.3.0

type BoundType string

BoundType declares bound types for region

type CPUHeadroomAssemblerName added in v0.2.0

type CPUHeadroomAssemblerName string

CPUHeadroomAssemblerName defines assemblers for cpu advisor to generate node headroom from region headroom or node level policy

const (
	CPUHeadroomAssemblerNone      CPUHeadroomAssemblerName = "none"
	CPUHeadroomAssemblerCommon    CPUHeadroomAssemblerName = "common"
	CPUHeadroomAssemblerDedicated CPUHeadroomAssemblerName = "dedicated"
)

type CPUHeadroomPolicyName added in v0.2.0

type CPUHeadroomPolicyName string

CPUHeadroomPolicyName defines policy names for cpu advisor headroom estimation

const (
	CPUHeadroomPolicyNone          CPUHeadroomPolicyName = "none"
	CPUHeadroomPolicyNonReclaim    CPUHeadroomPolicyName = "non-reclaim"
	CPUHeadroomPolicyCanonical     CPUHeadroomPolicyName = "canonical"
	CPUHeadroomPolicyNUMAExclusive CPUHeadroomPolicyName = "numa-exclusive"
)

type CPUProvisionAssemblerName added in v0.2.0

type CPUProvisionAssemblerName string

CPUProvisionAssemblerName defines assemblers for cpu advisor to generate node provision result from region control knobs

const (
	CPUProvisionAssemblerNone   CPUProvisionAssemblerName = "none"
	CPUProvisionAssemblerCommon CPUProvisionAssemblerName = "common"
)

type CPUProvisionPolicyName added in v0.2.0

type CPUProvisionPolicyName string

CPUProvisionPolicyName defines policy names for cpu advisor resource provision

const (
	CPUProvisionPolicyNone       CPUProvisionPolicyName = "none"
	CPUProvisionPolicyNonReclaim CPUProvisionPolicyName = "non-reclaim"
	CPUProvisionPolicyCanonical  CPUProvisionPolicyName = "canonical"
	CPUProvisionPolicyRama       CPUProvisionPolicyName = "rama"
)

type ContainerEntries

type ContainerEntries map[string]*ContainerInfo

ContainerEntries stores container info keyed by container name

func (ContainerEntries) Clone

type ContainerInfo

type ContainerInfo struct {
	// Metadata unchanged during container's lifecycle
	PodUID              string
	PodNamespace        string
	PodName             string
	ContainerName       string
	ContainerType       v1alpha1.ContainerType
	ContainerIndex      int
	Labels              map[string]string
	Annotations         map[string]string
	QoSLevel            string
	CPURequest          float64
	CPULimit            float64
	MemoryRequest       float64
	MemoryLimit         float64
	OriginOwnerPoolName string

	// Allocation information changing by list and watch (and
	// should not be changed by other components or processes)
	RampUp                           bool
	OwnerPoolName                    string
	TopologyAwareAssignments         TopologyAwareAssignment
	OriginalTopologyAwareAssignments TopologyAwareAssignment

	// QoS information updated by advisor
	RegionNames sets.String
	Isolated    bool
}

ContainerInfo contains container information for sysadvisor plugins

func (*ContainerInfo) Clone

func (ci *ContainerInfo) Clone() *ContainerInfo

func (*ContainerInfo) IsNumaBinding added in v0.2.0

func (ci *ContainerInfo) IsNumaBinding() bool

IsNumaBinding returns true if current container is for dedicated_cores with numa binding

func (*ContainerInfo) IsNumaExclusive added in v0.3.0

func (ci *ContainerInfo) IsNumaExclusive() bool

func (*ContainerInfo) UpdateMeta

func (ci *ContainerInfo) UpdateMeta(c *ContainerInfo)

UpdateMeta updates mutable container meta from another container info

type ContainerInfoList added in v0.3.0

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

func (*ContainerInfoList) GetSource added in v0.3.0

func (cl *ContainerInfoList) GetSource(index int) interface{}

func (*ContainerInfoList) Len added in v0.3.0

func (cl *ContainerInfoList) Len() int

func (*ContainerInfoList) SetSource added in v0.3.0

func (cl *ContainerInfoList) SetSource(index int, p interface{})

type ContainerMemoryAdvices added in v0.3.0

type ContainerMemoryAdvices struct {
	PodUID        string
	ContainerName string
	Values        map[string]string
}

type ControlEssentials added in v0.3.0

type ControlEssentials struct {
	ControlKnobs   ControlKnob
	Indicators     Indicator
	ReclaimOverlap bool
}

ControlEssentials defines essential metrics for cpu advisor feedback control

type ControlKnob added in v0.2.0

type ControlKnob map[ControlKnobName]ControlKnobValue

ControlKnob holds tunable system entries affecting indicator metrics

func (ControlKnob) Clone added in v0.2.0

func (ck ControlKnob) Clone() ControlKnob

type ControlKnobAction added in v0.2.0

type ControlKnobAction string

ControlKnobAction defines control knob adjustment actions

const (
	ControlKnobActionNone ControlKnobAction = "none"
)

type ControlKnobName added in v0.2.0

type ControlKnobName string

ControlKnobName defines available control knob key for provision policy

const (
	// ControlKnobNonReclaimedCPUSize refers to cpu requirement of non-reclaimed workloads
	ControlKnobNonReclaimedCPUSize ControlKnobName = "non-reclaimed-cpu-size"

	// ControlKnobNonReclaimedCPUSizeUpper refers to the upper cpu size, for isolated pods now
	ControlKnobNonReclaimedCPUSizeUpper ControlKnobName = "non-reclaimed-cpu-size-upper"

	// ControlKnobNonReclaimedCPUSizeLower refers to the lower cpu size, for isolated pods now
	ControlKnobNonReclaimedCPUSizeLower ControlKnobName = "non-reclaimed-cpu-size-lower"
)

type ControlKnobValue added in v0.2.0

type ControlKnobValue struct {
	Value  float64
	Action ControlKnobAction
}

ControlKnobValue holds control knob value and action

type ExtraMemoryAdvices added in v0.3.0

type ExtraMemoryAdvices struct {
	CgroupPath string
	Values     map[string]string
}

type FirstOrderPIDParams added in v0.3.0

type FirstOrderPIDParams struct {
	Kpp                  float64
	Kpn                  float64
	Kdp                  float64
	Kdn                  float64
	AdjustmentUpperBound float64
	AdjustmentLowerBound float64
	DeadbandUpperPct     float64
	DeadbandLowerPct     float64
}

FirstOrderPIDParams holds parameters for pid controller in rama policy

type Indicator added in v0.2.0

type Indicator map[string]IndicatorValue

Indicator holds system metrics related to service stability keyed by metric name

func (Indicator) Clone added in v0.2.0

func (i Indicator) Clone() Indicator

type IndicatorCurrentGetter added in v0.3.0

type IndicatorCurrentGetter func() (float64, error)

IndicatorCurrentGetter get pod indicator current value by podUID

type IndicatorTargetConfiguration added in v0.4.1

type IndicatorTargetConfiguration struct {
	Name   string
	Target float64
}

type IndicatorValue added in v0.2.0

type IndicatorValue struct {
	Current float64
	Target  float64
}

IndicatorValue holds indicator values of different levels

type InternalCPUCalculationResult added in v0.3.0

type InternalCPUCalculationResult struct {
	PoolEntries map[string]map[int]int // map[poolName][numaId]cpuSize
	TimeStamp   time.Time
}

InternalCPUCalculationResult conveys minimal information to cpu server for composing calculation result

func (*InternalCPUCalculationResult) GetPoolEntry added in v0.3.0

func (r *InternalCPUCalculationResult) GetPoolEntry(poolName string, numaID int) (int, bool)

func (*InternalCPUCalculationResult) SetPoolEntry added in v0.3.0

func (r *InternalCPUCalculationResult) SetPoolEntry(poolName string, numaID int, poolSize int)

type InternalMemoryCalculationResult added in v0.3.0

type InternalMemoryCalculationResult struct {
	ContainerEntries []ContainerMemoryAdvices
	ExtraEntries     []ExtraMemoryAdvices
	TimeStamp        time.Time
}

type MemoryAdvisorPluginName added in v0.3.0

type MemoryAdvisorPluginName string

type MemoryHeadroomPolicyName added in v0.2.0

type MemoryHeadroomPolicyName string

MemoryHeadroomPolicyName defines policy names for memory advisor headroom estimation

type MemoryPressureCondition added in v0.3.0

type MemoryPressureCondition struct {
	TargetReclaimed *resource.Quantity
	State           MemoryPressureState
}

type MemoryPressureState added in v0.3.0

type MemoryPressureState int

type MemoryPressureStatus added in v0.3.0

type MemoryPressureStatus struct {
	NodeCondition  *MemoryPressureCondition
	NUMAConditions map[int]*MemoryPressureCondition
}

type MemoryProvisionPolicyName added in v0.4.0

type MemoryProvisionPolicyName string

MemoryProvisionPolicyName defines policy names for memory advisor resource provision

type NumaMemoryBalanceAdvice added in v0.4.1

type NumaMemoryBalanceAdvice struct {
	DestNumaList      []int                            `json:"destNumaList"`
	SourceNuma        int                              `json:"sourceNuma"`
	MigrateContainers []NumaMemoryBalanceContainerInfo `json:"migrateContainers"`
	TotalRSS          float64                          `json:"totalRSS"`
	// if the successful migrated memory ratio is over this threshold, this turn can be considered successful.
	Threshold float64 `json:"threshold"`
}

type NumaMemoryBalanceContainerInfo added in v0.4.1

type NumaMemoryBalanceContainerInfo struct {
	PodUID        string `json:"podUID"`
	ContainerName string `json:"containerName"`
	DestNumaList  []int  `json:"destNumaList"`
}

type OvershootType added in v0.3.0

type OvershootType string

OvershootType declares overshoot type for region

const (
	// OvershootTrue indicates overshoot
	OvershootTrue OvershootType = "true"

	// OvershootFalse indicates not overshoot
	OvershootFalse OvershootType = "false"

	// OvershootUnknown indicates unknown overshoot status
	OvershootUnknown OvershootType = "unknown"
)

type PodEntries

type PodEntries map[string]ContainerEntries

PodEntries stores container info keyed by pod uid and container name

func (PodEntries) Clone

func (pe PodEntries) Clone() PodEntries

type PodSet added in v0.2.0

type PodSet map[string]sets.String

PodSet stores container names keyed by pod uid

func (PodSet) Clone added in v0.2.0

func (ps PodSet) Clone() PodSet

func (PodSet) Insert added in v0.2.0

func (ps PodSet) Insert(podUID string, containerName string)

func (PodSet) Pods added in v0.4.0

func (ps PodSet) Pods() int

func (PodSet) PopAny added in v0.4.0

func (ps PodSet) PopAny() (string, string, bool)

PopAny Returns a single element from the set, in format of podUID, containerName

type PolicyUpdateStatus added in v0.2.0

type PolicyUpdateStatus string

PolicyUpdateStatus works as a flag indicating update result

const (
	PolicyUpdateSucceeded PolicyUpdateStatus = "succeeded"
	PolicyUpdateFailed    PolicyUpdateStatus = "failed"
)

type PoolEntries

type PoolEntries map[string]*PoolInfo

PoolEntries stores pool info keyed by pool name

func (PoolEntries) Clone

func (pe PoolEntries) Clone() PoolEntries

type PoolInfo

type PoolInfo struct {
	PoolName                         string
	TopologyAwareAssignments         TopologyAwareAssignment
	OriginalTopologyAwareAssignments TopologyAwareAssignment
	RegionNames                      sets.String
}

PoolInfo contains pool information for sysadvisor plugins

func (*PoolInfo) Clone

func (pi *PoolInfo) Clone() *PoolInfo

type QoSRegionType added in v0.2.0

type QoSRegionType string

QoSRegionType declares pre-defined region types

const (
	// QoSRegionTypeShare for each share pool
	QoSRegionTypeShare QoSRegionType = "share"

	// QoSRegionTypeIsolation for each isolation pool
	QoSRegionTypeIsolation QoSRegionType = "isolation"

	// QoSRegionTypeDedicatedNumaExclusive for each dedicated core with numa binding
	// and numa exclusive container
	QoSRegionTypeDedicatedNumaExclusive QoSRegionType = "dedicated-numa-exclusive"
)

type QoSResourceName

type QoSResourceName string

QoSResourceName describes different resources under qos aware control

const (
	QoSResourceCPU    QoSResourceName = "cpu"
	QoSResourceMemory QoSResourceName = "memory"
)

type RegionEntries added in v0.2.0

type RegionEntries map[string]*RegionInfo

RegionEntries stores region info keyed by region name

func (RegionEntries) Clone added in v0.2.0

func (re RegionEntries) Clone() RegionEntries

type RegionInfo added in v0.2.0

type RegionInfo struct {
	RegionName    string         `json:"region_name"`
	RegionType    QoSRegionType  `json:"region_type"`
	OwnerPoolName string         `json:"owner_pool_name"`
	BindingNumas  machine.CPUSet `json:"binding_numas"`
	RegionStatus  RegionStatus   `json:"region_status"`

	ControlKnobMap             ControlKnob            `json:"control_knob_map"`
	ProvisionPolicyTopPriority CPUProvisionPolicyName `json:"provision_policy_top_priority"`
	ProvisionPolicyInUse       CPUProvisionPolicyName `json:"provision_policy_in_use"`

	Headroom                  float64               `json:"headroom"`
	HeadroomPolicyTopPriority CPUHeadroomPolicyName `json:"headroom_policy_top_priority"`
	HeadroomPolicyInUse       CPUHeadroomPolicyName `json:"headroom_policy_in_use"`
}

RegionInfo contains region information generated by sysadvisor resource advisor

func (*RegionInfo) Clone added in v0.2.0

func (ri *RegionInfo) Clone() *RegionInfo

type RegionStatus added in v0.3.0

type RegionStatus struct {
	OvershootStatus map[string]OvershootType `json:"overshoot_status"` // map[indicatorMetric]overshootType
	BoundType       BoundType                `json:"bound_type"`
}

RegionStatus holds stability accounting info of region

func (RegionStatus) Clone added in v0.4.0

func (rs RegionStatus) Clone() RegionStatus

type ResourceEssentials added in v0.2.0

type ResourceEssentials struct {
	EnableReclaim       bool
	ResourceUpperBound  float64
	ResourceLowerBound  float64
	ReservedForReclaim  float64
	ReservedForAllocate float64
}

ResourceEssentials defines essential (const) variables, and those variables may be adjusted by KCC

type TopologyAwareAssignment added in v0.2.0

type TopologyAwareAssignment map[int]machine.CPUSet

func (TopologyAwareAssignment) Clone added in v0.2.0

func (TopologyAwareAssignment) Equals added in v0.2.0

func (TopologyAwareAssignment) MergeCPUSet added in v0.2.0

func (ta TopologyAwareAssignment) MergeCPUSet() machine.CPUSet

MergeCPUSet returns a merged machine.CPUSet belonging to this TopologyAwareAssignment

type TriggerInfo added in v0.4.0

type TriggerInfo struct {
	TimeStamp time.Time
}

Jump to

Keyboard shortcuts

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