utils

package
v0.0.0-...-da31dff Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MiB = 1024 * 1024

MiB represents megabate (2^20) multiplier

View Source
const NothingReturned = "Nothing returned"

NothingReturned is a no-value marker returned by GetStringFromChan and GetStringFromChanImmediately functions

Variables

This section is empty.

Functions

func FilterOutExpendableAndSplit

func FilterOutExpendableAndSplit(unschedulableCandidates []*apiv1.Pod, nodes []*apiv1.Node, expendablePodsPriorityCutoff int) ([]*apiv1.Pod, []*apiv1.Pod)

FilterOutExpendableAndSplit filters out expendable pods and splits into:

  • waiting for lower priority pods preemption
  • other pods.

func FilterOutExpendablePods

func FilterOutExpendablePods(pods []*apiv1.Pod, expendablePodsPriorityCutoff int) []*apiv1.Pod

FilterOutExpendablePods filters out expendable pods.

func FilterOutNodesFromNotAutoscaledGroups

func FilterOutNodesFromNotAutoscaledGroups(nodes []*apiv1.Node, cloudProvider cloudprovider.CloudProvider) ([]*apiv1.Node, errors.AutoscalerError)

FilterOutNodesFromNotAutoscaledGroups return subset of input nodes for which cloud provider does not return autoscaled node group.

func GetNodeCoresAndMemory

func GetNodeCoresAndMemory(node *apiv1.Node) (int64, int64)

GetNodeCoresAndMemory extracts cpu and memory resources out of Node object

func GetOldestCreateTime

func GetOldestCreateTime(pods []*apiv1.Pod) time.Time

GetOldestCreateTime returns oldest creation time out of the pods in the set

func GetOldestCreateTimeWithGpu

func GetOldestCreateTimeWithGpu(pods []*apiv1.Pod) (bool, time.Time)

GetOldestCreateTimeWithGpu returns oldest creation time out of pods with GPU in the set

func GetStringFromChan

func GetStringFromChan(c chan string) string

GetStringFromChan returns a value from channel or NothingReturned if no value in channel after timeout of 100 ms.

func GetStringFromChanImmediately

func GetStringFromChanImmediately(c chan string) string

GetStringFromChanImmediately returns a value from channel or NothingReturned if no value in channel.

func IsExpendablePod

func IsExpendablePod(pod *apiv1.Pod, expendablePodsPriorityCutoff int) bool

IsExpendablePod tests if pod is expendable for give priority cutoff

func UpdateClusterStateMetrics

func UpdateClusterStateMetrics(csr *clusterstate.ClusterStateRegistry)

UpdateClusterStateMetrics updates metrics related to cluster state

Types

This section is empty.

Jump to

Keyboard shortcuts

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