algo

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const MaxScore int = 10
View Source
const MinScore int = 0

Variables

This section is empty.

Functions

func AllocateDeviceVolume

func AllocateDeviceVolume(pod *corev1.Pod, pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node,
	ctx *algorithm.SchedulingContext) (fits bool, units []cache.AllocatedUnit, err error)

func AllocateLVMVolume

func AllocateLVMVolume(pod *corev1.Pod, pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node, ctx *algorithm.SchedulingContext) (fits bool, units []cache.AllocatedUnit, err error)

AllocateLVMVolume contains two policy: BINPACK/SPREAD

func AllocateMountPointVolume

func AllocateMountPointVolume(
	pod *corev1.Pod, pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node,
	ctx *algorithm.SchedulingContext) (fits bool, units []cache.AllocatedUnit, err error)

func Binpack

func Binpack(pod *corev1.Pod, pvc *corev1.PersistentVolumeClaim, node *corev1.Node, cacheVGsMap map[cache.ResourceName]cache.SharedResource) (fits bool, units []cache.AllocatedUnit, err error)

func CheckExclusiveResourceMeetsPVCSize

func CheckExclusiveResourceMeetsPVCSize(resource localtype.VolumeType, ers []cache.ExclusiveResource, pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node, ctx *algorithm.SchedulingContext) (fits bool, units []cache.AllocatedUnit, err error)

func DivideLVMPVCs

func DivideLVMPVCs(pvcs []*corev1.PersistentVolumeClaim, ctx *algorithm.SchedulingContext) (pvcsWithVG, pvcsWithoutVG []*corev1.PersistentVolumeClaim)

DivideLVMPVCs divide pvcs into pvcsWithVG and pvcsWithoutVG

func DividePVCAccordingToMediaType

func DividePVCAccordingToMediaType(pvcs []*corev1.PersistentVolumeClaim, scLister storagelisters.StorageClassLister) (pvcsWithTypeSSD, pvcsWithTypeHDD []*corev1.PersistentVolumeClaim, err error)

DividePVCAccordingToMediaType divide pvcs into pvcsWithSSD and pvcsWithHDD

func GetCacheDeviceCount

func GetCacheDeviceCount(node *corev1.Node, ctx *algorithm.SchedulingContext) (count int64, err error)

GetCacheDeviceCount get Device count from ClusterNodeCache

func GetCacheMPCount

func GetCacheMPCount(node *corev1.Node, ctx *algorithm.SchedulingContext) (count int64, err error)

GetCacheMPCount get MP count from ClusterNodeCache

func GetFreeDevice

func GetFreeDevice(node *corev1.Node, ctx *algorithm.SchedulingContext) (freeDeviceSSD, freeDeviceHDD []cache.ExclusiveResource, err error)

GetFreeDevice divide nodeCache.Devices into freeDeviceSSD and freeDeviceHDD

func GetFreeMP

func GetFreeMP(node *corev1.Node, ctx *algorithm.SchedulingContext) (freeMPSSD, freeMPHDD []cache.ExclusiveResource, err error)

GetFreeMP divide nodeCache.MountPoints into freeMPSSD and freeMPHDD

func GetNodeVGMap

func GetNodeVGMap(node *corev1.Node, ctx *algorithm.SchedulingContext) (cacheVGsMap map[cache.ResourceName]cache.SharedResource, err error)

GetNodeVGMap make a copy map of NodeCache VGs

func HandleInlineLVMVolume added in v0.5.0

func HandleInlineLVMVolume(ctx *algorithm.SchedulingContext, node *corev1.Node, pod *corev1.Pod) (fits bool, units []cache.AllocatedUnit, err error)

func ProcessDevicePVC

func ProcessDevicePVC(pod *corev1.Pod, pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node, ctx *algorithm.SchedulingContext) (fits bool, units []cache.AllocatedUnit, err error)

func ProcessLVMPVCPredicate

func ProcessLVMPVCPredicate(pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node, ctx *algorithm.SchedulingContext) (fits bool, units []cache.AllocatedUnit, err error)

func ProcessLVMPVCPriority

func ProcessLVMPVCPriority(pod *corev1.Pod, pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node, ctx *algorithm.SchedulingContext) (fits bool, units []cache.AllocatedUnit, err error)

func ProcessMPPVC

func ProcessMPPVC(pod *corev1.Pod, pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node, ctx *algorithm.SchedulingContext) (fits bool, units []cache.AllocatedUnit, err error)

func ProcessSnapshotPVC

func ProcessSnapshotPVC(pvcs []*corev1.PersistentVolumeClaim, nodeName string, coreV1Informers corev1informers.Interface, snapshotInformers volumesnapshotinformers.Interface) (fits bool, err error)

If there is no readonly snapshot pvc, just return true

func ScoreDevice

func ScoreDevice(units []cache.AllocatedUnit) (score int)

func ScoreDeviceVolume

func ScoreDeviceVolume(
	pod *corev1.Pod, pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node,
	ctx *algorithm.SchedulingContext) (score int, units []cache.AllocatedUnit, err error)

func ScoreInlineLVMVolume added in v0.5.0

func ScoreInlineLVMVolume(pod *corev1.Pod, node *corev1.Node, ctx *algorithm.SchedulingContext) (score int, units []cache.AllocatedUnit, err error)

func ScoreLVM

func ScoreLVM(units []cache.AllocatedUnit, cacheVGsMap map[cache.ResourceName]cache.SharedResource) (score int)

func ScoreLVMVolume

func ScoreLVMVolume(pod *corev1.Pod, pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node, ctx *algorithm.SchedulingContext) (score int, units []cache.AllocatedUnit, err error)

不需要单独处理 readonly snapshot, 因为若filter阶段只选出一个node,不会进入score。

func ScoreMP

func ScoreMP(units []cache.AllocatedUnit) (score int)

func ScoreMountPointVolume

func ScoreMountPointVolume(
	pod *corev1.Pod, pvcs []*corev1.PersistentVolumeClaim, node *corev1.Node,
	ctx *algorithm.SchedulingContext) (score int, units []cache.AllocatedUnit, err error)

func Spread

func Spread(pod *corev1.Pod, pvc *corev1.PersistentVolumeClaim, node *corev1.Node, cacheVGsMap map[cache.ResourceName]cache.SharedResource) (fits bool, units []cache.AllocatedUnit, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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