util

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MidCPUThreshold                = "midCPUThreshold"
	MidMemoryThreshold             = "midMemoryThreshold"
	MidUnallocatedPercent          = "midUnallocatedPercent"
	MidStaticCPUReservedPercent    = "midStaticCPUReservedPercent"
	MidStaticMemoryReservedPercent = "midStaticMemoryReservedPercent"
	BatchCPUThreshold              = "batchCPUThreshold"
	BatchMemoryThreshold           = "batchMemoryThreshold"
)

Variables

This section is empty.

Functions

func AddZoneResourceList

func AddZoneResourceList(a, b []corev1.ResourceList, zoneNum int) []corev1.ResourceList

func CalculateBatchResourceByPolicy

func CalculateBatchResourceByPolicy(strategy *configuration.ColocationStrategy, nodeCapacity, nodeSafetyMargin, nodeReserved,
	systemUsed, podHPReq, podHPUsed, podHPMaxUsedReq corev1.ResourceList) (corev1.ResourceList, string, string)

func CalculateMidResourceByPolicy

func CalculateMidResourceByPolicy(strategy *configuration.ColocationStrategy, nodeCapacity, unallocated, nodeUnused corev1.ResourceList, allocatableMilliCPU, allocatableMemory int64,
	prodReclaimableCPU, prodReclaimableMemory *resource.Quantity, nodeName string) (*resource.Quantity, *resource.Quantity, string, string)

func CalculateMidResourceByStaticMode added in v1.8.0

func CalculateMidResourceByStaticMode(strategy *configuration.ColocationStrategy, nodeCapacity corev1.ResourceList, nodeName string) (*resource.Quantity, *resource.Quantity, string, string)

func DivideResourceList

func DivideResourceList(rl corev1.ResourceList, divisor float64) corev1.ResourceList

func GetHostAppHPUsed

func GetHostAppHPUsed(resourceMetrics *framework.ResourceMetrics, resPriority extension.PriorityClass) corev1.ResourceList

func GetHostAppMetricUsage

func GetHostAppMetricUsage(info *slov1alpha1.HostApplicationMetricInfo) corev1.ResourceList

GetHostAppMetricUsage gets host application usage from HostApplicationMetricInfo

func GetNodeCapacity

func GetNodeCapacity(node *corev1.Node) corev1.ResourceList

GetNodeCapacity gets node capacity and filters out non-CPU and non-Mem resources

func GetNodeSafetyMargin

func GetNodeSafetyMargin(strategy *configuration.ColocationStrategy, nodeCapacity corev1.ResourceList) corev1.ResourceList

GetNodeSafetyMargin gets node-level safe-guarding reservation with the node's allocatable

func GetPodMetricUsage

func GetPodMetricUsage(info *slov1alpha1.PodMetricInfo) corev1.ResourceList

GetPodMetricUsage gets pod usage from the PodMetricInfo

func GetPodNUMARequestAndUsage

func GetPodNUMARequestAndUsage(pod *corev1.Pod, podRequest, podUsage corev1.ResourceList, numaNum int) ([]corev1.ResourceList, []corev1.ResourceList)

GetPodNUMARequestAndUsage returns the pod request and usage on each NUMA nodes. It averages the metrics over all sharepools when the pod does not allocate any sharepool or use all sharepools.

func GetPodUnknownNUMAUsage

func GetPodUnknownNUMAUsage(podUsage corev1.ResourceList, numaNum int) []corev1.ResourceList

func GetResourceListForCPUAndMemory

func GetResourceListForCPUAndMemory(rl corev1.ResourceList) corev1.ResourceList

func IsValidNodeUsage

func IsValidNodeUsage(nodeMetric *slov1alpha1.NodeMetric) (bool, string)

func MaxZoneResourceList

func MaxZoneResourceList(a, b []corev1.ResourceList, zoneNum int) []corev1.ResourceList

func MinxZoneResourceListCPUAndMemory

func MinxZoneResourceListCPUAndMemory(resourcesForCPU, resourcesForMemory []corev1.ResourceList, zoneNum int) []corev1.ResourceList

func MixResourceListCPUAndMemory

func MixResourceListCPUAndMemory(resourcesForCPU, resourcesForMemory corev1.ResourceList) corev1.ResourceList

func PrepareNodeForResource

func PrepareNodeForResource(node *corev1.Node, nr *framework.NodeResource, name corev1.ResourceName)

func UpdateNRTZoneListIfNeeded

func UpdateNRTZoneListIfNeeded(node *corev1.Node, zoneList topologyv1alpha1.ZoneList, nr *framework.NodeResource, diffThreshold float64) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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