util

package
v0.5.35 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 20 Imported by: 5

Documentation

Index

Constants

View Source
const (
	FakePodUID = ""
)

Variables

View Source
var (
	ErrNoAvailableCPUHints             = pkgerrors.New("no available cpu hints")
	ErrNoAvailableMemoryBandwidthHints = pkgerrors.New("no available memory bandwidth hints")
)

Functions

func AdvisorDegradation added in v0.5.4

func AdvisorDegradation(advisorHealth, enableReclaim bool) bool

func CPUIsSufficient added in v0.5.12

func CPUIsSufficient(request, available float64) bool

func GetContainerRequestedCores added in v0.5.28

func GetContainerRequestedCores(metaServer *metaserver.MetaServer, allocationInfo *state.AllocationInfo) float64

GetContainerRequestedCores parses and returns request cores for the given container

func GetCoresReservedForSystem added in v0.4.0

func GetCoresReservedForSystem(conf *config.Configuration, metaServer *metaserver.MetaServer, machineInfo *machine.KatalystMachineInfo, allCPUs machine.CPUSet) (machine.CPUSet, error)

func PackAllocationResponse added in v0.4.0

func PackAllocationResponse(allocationInfo *state.AllocationInfo, resourceName, ociPropertyName string,
	isNodeResource, isScalarResource bool, req *pluginapi.ResourceRequest,
) (*pluginapi.ResourceAllocationResponse, error)

PackAllocationResponse fills pluginapi.ResourceAllocationResponse with information from AllocationInfo and pluginapi.ResourceRequest

func PopulateHintsByAvailableNUMANodes added in v0.5.28

func PopulateHintsByAvailableNUMANodes(
	numaNodes []int,
	hints *pluginapi.ListOfTopologyHints,
	preferred bool,
)

func RegenerateHints added in v0.4.0

func RegenerateHints(allocationInfo *state.AllocationInfo, regenerate bool) map[string]*pluginapi.ListOfTopologyHints

RegenerateHints regenerates hints for container that'd already been allocated cpu, and regenerateHints will assemble hints based on already-existed AllocationInfo, without any calculation logics at all

Types

type Entries added in v0.5.33

type Entries map[string]SubEntries

Entries are keyed by pod UID or pool name

type MetricInfo added in v0.5.33

type MetricInfo struct {
	Name       string
	Value      float64
	UpperBound float64
	LowerBound float64
}

type MetricRing added in v0.5.33

type MetricRing struct {
	MaxLen       int
	Queue        []*MetricSnapshot
	CurrentIndex int

	sync.RWMutex
}

func CreateMetricRing added in v0.5.33

func CreateMetricRing(size int) *MetricRing

func (*MetricRing) Avg added in v0.5.33

func (ring *MetricRing) Avg() float64

func (*MetricRing) AvgAfterTimestampWithCountBound added in v0.5.33

func (ring *MetricRing) AvgAfterTimestampWithCountBound(ts int64, countBound int) (float64, error)

func (*MetricRing) Count added in v0.5.33

func (ring *MetricRing) Count() (softOverCount, hardOverCount int)

func (*MetricRing) Len added in v0.5.33

func (ring *MetricRing) Len() int

func (*MetricRing) OverCount added in v0.5.33

func (ring *MetricRing) OverCount(threshold float64) (overCount int)

OverCount pass threshold from outside

func (*MetricRing) Push added in v0.5.33

func (ring *MetricRing) Push(snapShot *MetricSnapshot)

func (*MetricRing) Sum added in v0.5.33

func (ring *MetricRing) Sum() float64

type MetricSnapshot added in v0.5.33

type MetricSnapshot struct {
	Info MetricInfo
	Time int64
}

type NumaMetricHistory added in v0.5.33

type NumaMetricHistory struct {
	// numa -> pod -> metric -> ring
	Inner    map[int]map[string]map[string]*MetricRing
	RingSize int
}

func NewMetricHistory added in v0.5.33

func NewMetricHistory(ringSize int) *NumaMetricHistory

func (*NumaMetricHistory) Push added in v0.5.33

func (m *NumaMetricHistory) Push(numaID int, podUID string, metricName string, podMetric float64)

func (*NumaMetricHistory) PushNuma added in v0.5.33

func (m *NumaMetricHistory) PushNuma(numaID int, metricName string, podMetric float64)

type PoolMetricCollectHandler added in v0.5.33

type PoolMetricCollectHandler func(dynamicConfig *dynamic.Configuration, poolsUnderPressure bool,
	metricName string, metricValue float64, poolName string,
	poolSize int, collectTime int64, allowSharedCoresOverlapReclaimedCores bool)

type SubEntries added in v0.5.33

type SubEntries map[string]*MetricRing

SubEntries is keyed by container name or empty string (for pool)

func (SubEntries) IsPoolEntry added in v0.5.33

func (se SubEntries) IsPoolEntry() bool

Jump to

Keyboard shortcuts

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