utils

package
v0.0.0-...-4f1c8e6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 16 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 DeepCopyNodeInfo

func DeepCopyNodeInfo(nodeInfo *schedulerframework.NodeInfo) *schedulerframework.NodeInfo

DeepCopyNodeInfo clones the provided nodeInfo

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 GetNodeInfoFromTemplate

func GetNodeInfoFromTemplate(nodeGroup cloudprovider.NodeGroup, daemonsets []*appsv1.DaemonSet, taintConfig taints.TaintConfig) (*schedulerframework.NodeInfo, errors.AutoscalerError)

GetNodeInfoFromTemplate returns NodeInfo object built base on TemplateNodeInfo returned by NodeGroup.TemplateNodeInfo().

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 SanitizeNode

func SanitizeNode(node *apiv1.Node, nodeGroup string, taintConfig taints.TaintConfig) (*apiv1.Node, errors.AutoscalerError)

SanitizeNode cleans up nodes used for node group templates

func SanitizePods

func SanitizePods(pods []*apiv1.Pod, sanitizedNode *apiv1.Node) []*apiv1.Pod

SanitizePods cleans up pods used for node group templates

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