Documentation ¶
Index ¶
- Constants
- Variables
- func AddWorkloadInfoToPod(pod *corev1.Pod, kind string, name string, namespace string) *corev1.Pod
- func AdjustNodesOrder(nodes []string) []string
- func AdjustWorkloads(workloads map[string][]string)
- func CalculateL2NormDiff(vec1, vec2 []float64) (l2norm float64)
- func CalculateL2NormRatio(vec1, vec2 []float64) (l2norm float64)
- func CalculateVectorCosineSimilarity(vec1, vec2 []float64) float64
- func CalculateVectorDotProduct(vec1, vec2 []float64) (innerProduct float64)
- func CanNodeHostPodOnGpuMemory(nodeRes simontype.NodeResource, podRes simontype.PodResource) bool
- func CreateKubeClient(kubeconfig string) (*clientset.Clientset, error)
- func DecodeYamlContent(yamlRes []byte) ([]runtime.Object, error)
- func ExportNodeStatusToCsv(nodeStatus []simontype.NodeStatus, filePath string) error
- func GeneratePodKey(pod *corev1.Pod) string
- func GeneratePodKeyByName(namespace, name string) string
- func GenerateSchedulingMatchGroups(nodeRes simontype.NodeResource, podRes simontype.PodResource, ...) (matchGroups []simontype.SchedulingMatchGroup)
- func GetAllPodsPtrFromNodeStatus(nodeStatus []simontype.NodeStatus) []*corev1.Pod
- func GetAllocatablePodList(clientset externalclientset.Interface) []corev1.Pod
- func GetGpuFragMilliByNodeResAndPodRes(nodeRes simontype.NodeResource, podRes simontype.PodResource) int64
- func GetGpuMilliLeftTotal(nodeRes simontype.NodeResource) (gpuMilliLeftTotal int64)
- func GetGpuNodeInfoFromAnnotation(node *corev1.Node) (*gpusharecache.GpuNodeInfoStr, error)
- func GetMasterFromKubeConfig(filename string) (string, error)
- func GetNodeAllocMap(nodeStatus []simontype.NodeStatus) (map[string]AllocAmount, error)
- func GetNodeAllocatable(node *corev1.Node) (resource.Quantity, resource.Quantity)
- func GetNodeAllocatableCpuGpu(node *corev1.Node) []float64
- func GetNodeCache(node *corev1.Node) (*localcache.NodeCache, error)
- func GetNodePodFrag(nodeRes simontype.NodeResource, podRes simontype.PodResource) string
- func GetNodeResourceAndPodResourceViaHandle(p *corev1.Pod, nodeName string, handle framework.Handle) (nodeResPtr *simontype.NodeResource, podResPtr *simontype.PodResource)
- func GetNodeResourceMap(nodeStatus []simontype.NodeStatus) map[string]simontype.NodeResource
- func GetNodeResourceViaHandleAndName(handle framework.Handle, nodeName string) (nodeRes *simontype.NodeResource)
- func GetNodeResourceViaNodeInfo(nodeInfo *framework.NodeInfo) (nodeRes *simontype.NodeResource)
- func GetNodeResourceViaPodList(podList []*corev1.Pod, node *corev1.Node) (nodeRes *simontype.NodeResource)
- func GetObjectHashCodeDigit(isPod bool) int
- func GetPodLocalPVCs(pod *corev1.Pod) ([]*corev1.PersistentVolumeClaim, []*corev1.PersistentVolumeClaim)
- func GetPodResource(pod *corev1.Pod) simontype.PodResource
- func GetPodsPtrFromPods(pods []corev1.Pod) (podsPtr []*corev1.Pod)
- func GetPodsTotalRequestsAndLimitsByNodeName(pods []*corev1.Pod, nodeName string) (map[corev1.ResourceName]resource.Quantity, ...)
- func GetResourceSimilarity(nodeRes simontype.NodeResource, podRes simontype.PodResource) float64
- func GetSHA256HashCode(message []byte, num int) string
- func GetSkylinePods(allPods []*v1.Pod) (skylinePods simontype.SkylinePodList)
- func GetTypicalPods(allPods []*v1.Pod, config v1alpha1.TypicalPodsConfig) simontype.TargetPodList
- func GetYamlContentFromDirectory(dir string) ([]string, error)
- func IsNodeAccessibleToPod(nodeRes simontype.NodeResource, podRes simontype.PodResource) bool
- func IsNodeAccessibleToPodByType(nodeGpuType string, podGpuType string) bool
- func MakeValidNodeByNode(node *corev1.Node, nodename string) (*corev1.Node, error)
- func MakeValidPod(oldPod *corev1.Pod) (*corev1.Pod, error)
- func MakeValidPodByCronJob(cronjob *batchv1beta1.CronJob) ([]*corev1.Pod, error)
- func MakeValidPodByJob(job *batchv1.Job) ([]*corev1.Pod, error)
- func MakeValidPodByPod(pod *corev1.Pod) (*corev1.Pod, error)
- func MakeValidPodsByDaemonset(ds *appsv1.DaemonSet, nodes []*corev1.Node) ([]*corev1.Pod, error)
- func MakeValidPodsByDeployment(deploy *appsv1.Deployment) ([]*corev1.Pod, error)
- func MakeValidPodsByReplicaSet(rs *appsv1.ReplicaSet) ([]*corev1.Pod, error)
- func MakeValidPodsByReplicationController(rc *corev1.ReplicationController) ([]*corev1.Pod, error)
- func MakeValidPodsByStatefulSet(ss *appsv1.StatefulSet) ([]*corev1.Pod, error)
- func MeetResourceRequests(node *corev1.Node, pod *corev1.Pod, daemonSets []*appsv1.DaemonSet) (bool, error)
- func MultiplyMilliQuant(quant resource.Quantity, factor float64) resource.Quantity
- func MultiplyQuant(quant resource.Quantity, factor float64) resource.Quantity
- func NewDaemonPod(ds *appsv1.DaemonSet, nodeName string) (*corev1.Pod, error)
- func NodeGpuFragBasedOnSkyline(nodeRes simontype.NodeResource, skylinePods simontype.SkylinePodList) int64
- func NodeGpuFragBellman(nodeRes simontype.NodeResource, typicalPods simontype.TargetPodList, ...) float64
- func NodeGpuShareFragAmountScore(nodeRes simontype.NodeResource, typicalPods simontype.TargetPodList) float64
- func NodeShouldRunPod(node *corev1.Node, pod *corev1.Pod) bool
- func NormalizeVector(vec []float64, normVec []float64) []float64
- func ParseFilePath(path string) (filePaths []string, err error)
- func PodListRatioSum(tpl simontype.TargetPodList) (cumRatio float64)
- func ReadJsonFile(path string) []byte
- func ReadYamlFile(path string) []byte
- func RemovePodFromPodSliceByPod(pods []*corev1.Pod, pod *corev1.Pod) []*corev1.Pod
- func ReportFailedPods(fp []simontype.UnscheduledPod)
- func SetDaemonSetPodNodeNameByNodeAffinity(affinity *corev1.Affinity, nodename string) *corev1.Affinity
- func SetObjectMetaFromObject(owner metav1.Object, genPod bool) metav1.ObjectMeta
- func SetStorageAnnotationOnPods(pods []*corev1.Pod, volumeClaimTemplates []corev1.PersistentVolumeClaim, ...) error
- func SortTargetPodInDecreasingCount(tgtPodResMap map[simontype.PodResource]float64) simontype.TargetPodList
- func ValidateNode(node *corev1.Node) error
- func ValidatePod(pod *corev1.Pod) error
- type AllocAmount
- type FragAmount
- func GetFragAmountByNodeResAndFragRatio(nodeRes simontype.NodeResource, fragRatio FragRatio) FragAmount
- func NewFragAmount(nodeName string, data []float64) FragAmount
- func NodeGpuFragAmount(nodeRes simontype.NodeResource, typicalPods simontype.TargetPodList) FragAmount
- func NodeGpuShareFragAmount(nodeRes simontype.NodeResource, typicalPods simontype.TargetPodList) FragAmount
- func (fa FragAmount) AddByFragType(fragType string, amount float64) error
- func (fa FragAmount) AddFragAmount(faOther FragAmount) error
- func (fa FragAmount) AddGamma(faOther FragAmount, gamma float64) error
- func (fa FragAmount) FragAmountSumExceptQ3() (out float64)
- func (fa FragAmount) FragAmountSumQ1Q2Q4() (out float64)
- func (fa FragAmount) Repr() (outStr string)
- type FragRatio
- type NodeQueue
- type NodeStorage
- type ResourceSummary
- type Volume
- type VolumeRequest
Constants ¶
View Source
const ( ResourceMilliCpu = "MilliCpuLeft" ResourceMemory = "Memory" ResourceGpu = "Gpu" ResourceMilliGpu = "MilliGpu" )
View Source
const ( //ColorReset = "\033[0m" ColorReset = "" //ColorRed = "\033[31m" ColorRed = "" //ColorGreen = "\033[32m" ColorGreen = "" //ColorYellow = "\033[33m" ColorYellow = "" //ColorCyan = "\033[36m" ColorCyan = "" // open-local storage class names OpenLocalSCNameLVM = "open-local-lvm" OpenLocalSCNameDeviceHDD = "open-local-device-hdd" OpenLocalSCNameDeviceSSD = "open-local-device-ssd" OpenLocalSCNameMountPointHDD = "open-local-mountpoint-hdd" OpenLocalSCNameMountPointSSD = "open-local-mountpoint-ssd" // yoda storage class names YodaSCNameLVM = "yoda-lvm-default" YodaSCNameDeviceHDD = "yoda-device-hdd" YodaSCNameDeviceSSD = "yoda-device-ssd" YodaSCNameMountPointHDD = "yoda-mountpoint-hdd" YodaSCNameMountPointSSD = "yoda-mountpoint-ssd" )
View Source
const ( Q1LackBoth = "q1_lack_both" Q2LackGpu = "q2_lack_gpu" Q3Satisfied = "q3_satisfied" Q4LackCpu = "q4_lack_cpu" XLSatisfied = "xl_satisfied" XRLackCPU = "xr_lack_cpu" NoAccess = "no_access" )
Variables ¶
View Source
var FragRatioDataMap = map[string]int{ Q1LackBoth: 0, Q2LackGpu: 1, Q3Satisfied: 2, Q4LackCpu: 3, XLSatisfied: 4, XRLackCPU: 5, NoAccess: 6, }
View Source
var GpuNumTypeList = []string{"PureCpu", "ShareGpu", "OneGpu", "TwoGpu", "FourGpu", "EightGpu", "Others"}
Functions ¶
func AddWorkloadInfoToPod ¶
AddWorkloadInfoToPod add annotation in pod for simulating later
func AdjustNodesOrder ¶
func AdjustWorkloads ¶
func CalculateL2NormDiff ¶
func CalculateL2NormRatio ¶
func CalculateVectorCosineSimilarity ¶
CalculateVectorCosineSimilarity returns value in range [0, 1] or -1 (error)
func CanNodeHostPodOnGpuMemory ¶
func CanNodeHostPodOnGpuMemory(nodeRes simontype.NodeResource, podRes simontype.PodResource) bool
func DecodeYamlContent ¶
DecodeYamlContent captures the yml or yaml file, and decodes it
func ExportNodeStatusToCsv ¶
func ExportNodeStatusToCsv(nodeStatus []simontype.NodeStatus, filePath string) error
func GeneratePodKey ¶
func GeneratePodKeyByName ¶
func GenerateSchedulingMatchGroups ¶
func GenerateSchedulingMatchGroups(nodeRes simontype.NodeResource, podRes simontype.PodResource, gpuDimExtMethod simontype.GpuDimExtMethod, normMethod simontype.NormMethod) (matchGroups []simontype.SchedulingMatchGroup)
func GetAllPodsPtrFromNodeStatus ¶
func GetAllPodsPtrFromNodeStatus(nodeStatus []simontype.NodeStatus) []*corev1.Pod
func GetAllocatablePodList ¶
func GetAllocatablePodList(clientset externalclientset.Interface) []corev1.Pod
func GetGpuFragMilliByNodeResAndPodRes ¶
func GetGpuFragMilliByNodeResAndPodRes(nodeRes simontype.NodeResource, podRes simontype.PodResource) int64
func GetGpuMilliLeftTotal ¶
func GetGpuMilliLeftTotal(nodeRes simontype.NodeResource) (gpuMilliLeftTotal int64)
func GetGpuNodeInfoFromAnnotation ¶
func GetGpuNodeInfoFromAnnotation(node *corev1.Node) (*gpusharecache.GpuNodeInfoStr, error)
func GetMasterFromKubeConfig ¶
func GetNodeAllocMap ¶
func GetNodeAllocMap(nodeStatus []simontype.NodeStatus) (map[string]AllocAmount, error)
func GetNodeAllocatable ¶
func GetNodeCache ¶
func GetNodeCache(node *corev1.Node) (*localcache.NodeCache, error)
func GetNodePodFrag ¶
func GetNodePodFrag(nodeRes simontype.NodeResource, podRes simontype.PodResource) string
func GetNodeResourceAndPodResourceViaHandle ¶
func GetNodeResourceAndPodResourceViaHandle(p *corev1.Pod, nodeName string, handle framework.Handle) (nodeResPtr *simontype.NodeResource, podResPtr *simontype.PodResource)
func GetNodeResourceMap ¶
func GetNodeResourceMap(nodeStatus []simontype.NodeStatus) map[string]simontype.NodeResource
func GetNodeResourceViaHandleAndName ¶
func GetNodeResourceViaHandleAndName(handle framework.Handle, nodeName string) (nodeRes *simontype.NodeResource)
func GetNodeResourceViaNodeInfo ¶
func GetNodeResourceViaNodeInfo(nodeInfo *framework.NodeInfo) (nodeRes *simontype.NodeResource)
func GetObjectHashCodeDigit ¶
func GetPodLocalPVCs ¶
func GetPodLocalPVCs(pod *corev1.Pod) ([]*corev1.PersistentVolumeClaim, []*corev1.PersistentVolumeClaim)
func GetPodResource ¶
func GetPodResource(pod *corev1.Pod) simontype.PodResource
func GetResourceSimilarity ¶
func GetResourceSimilarity(nodeRes simontype.NodeResource, podRes simontype.PodResource) float64
func GetSHA256HashCode ¶
func GetSkylinePods ¶
func GetSkylinePods(allPods []*v1.Pod) (skylinePods simontype.SkylinePodList)
func GetTypicalPods ¶
func GetTypicalPods(allPods []*v1.Pod, config v1alpha1.TypicalPodsConfig) simontype.TargetPodList
func GetYamlContentFromDirectory ¶
GetYamlContentFromDirectory returns the yaml content and ignores other content
func IsNodeAccessibleToPod ¶
func IsNodeAccessibleToPod(nodeRes simontype.NodeResource, podRes simontype.PodResource) bool
func MakeValidNodeByNode ¶
func MakeValidPod ¶
MakeValidPod make pod valid, so we can handle it
func MakeValidPodByCronJob ¶
func MakeValidPodByCronJob(cronjob *batchv1beta1.CronJob) ([]*corev1.Pod, error)
func MakeValidPodsByDeployment ¶
func MakeValidPodsByDeployment(deploy *appsv1.Deployment) ([]*corev1.Pod, error)
func MakeValidPodsByReplicaSet ¶
func MakeValidPodsByReplicaSet(rs *appsv1.ReplicaSet) ([]*corev1.Pod, error)
func MakeValidPodsByReplicationController ¶
func MakeValidPodsByReplicationController(rc *corev1.ReplicationController) ([]*corev1.Pod, error)
func MakeValidPodsByStatefulSet ¶
func MakeValidPodsByStatefulSet(ss *appsv1.StatefulSet) ([]*corev1.Pod, error)
func MeetResourceRequests ¶
func MultiplyMilliQuant ¶
MultiplyMilliQuant scales quantity by factor
func MultiplyQuant ¶
MultiplyQuant scales quantity by factor
func NodeGpuFragBasedOnSkyline ¶
func NodeGpuFragBasedOnSkyline(nodeRes simontype.NodeResource, skylinePods simontype.SkylinePodList) int64
func NodeGpuFragBellman ¶
func NodeGpuFragBellman(nodeRes simontype.NodeResource, typicalPods simontype.TargetPodList, dp *sync.Map, cumProb float64) float64
func NodeGpuShareFragAmountScore ¶
func NodeGpuShareFragAmountScore(nodeRes simontype.NodeResource, typicalPods simontype.TargetPodList) float64
func NodeShouldRunPod ¶
NodeShouldRunPod determines whether a node should run a pod according to scheduling rules
func NormalizeVector ¶
func ParseFilePath ¶
ParseFilePath converts recursively directory path to a slice of file paths
func PodListRatioSum ¶
func PodListRatioSum(tpl simontype.TargetPodList) (cumRatio float64)
func ReadJsonFile ¶
func ReadYamlFile ¶
func ReportFailedPods ¶
func ReportFailedPods(fp []simontype.UnscheduledPod)
func SetObjectMetaFromObject ¶
func SetObjectMetaFromObject(owner metav1.Object, genPod bool) metav1.ObjectMeta
func SortTargetPodInDecreasingCount ¶
func SortTargetPodInDecreasingCount(tgtPodResMap map[simontype.PodResource]float64) simontype.TargetPodList
Types ¶
type AllocAmount ¶
func (AllocAmount) Add ¶
func (a AllocAmount) Add(b AllocAmount) error
type FragAmount ¶
func GetFragAmountByNodeResAndFragRatio ¶
func GetFragAmountByNodeResAndFragRatio(nodeRes simontype.NodeResource, fragRatio FragRatio) FragAmount
func NewFragAmount ¶
func NewFragAmount(nodeName string, data []float64) FragAmount
func NodeGpuFragAmount ¶
func NodeGpuFragAmount(nodeRes simontype.NodeResource, typicalPods simontype.TargetPodList) FragAmount
NodeGpuFragAmount is deprecated. Use NodeGpuShareFragAmount instead.
func NodeGpuShareFragAmount ¶
func NodeGpuShareFragAmount(nodeRes simontype.NodeResource, typicalPods simontype.TargetPodList) FragAmount
func (FragAmount) AddByFragType ¶
func (fa FragAmount) AddByFragType(fragType string, amount float64) error
func (FragAmount) AddFragAmount ¶
func (fa FragAmount) AddFragAmount(faOther FragAmount) error
func (FragAmount) AddGamma ¶
func (fa FragAmount) AddGamma(faOther FragAmount, gamma float64) error
func (FragAmount) FragAmountSumExceptQ3 ¶
func (fa FragAmount) FragAmountSumExceptQ3() (out float64)
func (FragAmount) FragAmountSumQ1Q2Q4 ¶
func (fa FragAmount) FragAmountSumQ1Q2Q4() (out float64)
func (FragAmount) Repr ¶
func (fa FragAmount) Repr() (outStr string)
type FragRatio ¶
type FragRatio struct {
Data []float64
}
func NodeGpuFragRatio ¶
func NodeGpuFragRatio(nodeRes simontype.NodeResource, typicalPods simontype.TargetPodList) FragRatio
func (FragRatio) FragRatioSumExceptQ3 ¶
type NodeQueue ¶
type NodeQueue struct {
// contains filtered or unexported fields
}
func NewNodeQueue ¶
type NodeStorage ¶
type NodeStorage struct { VGs []localcache.SharedResource `json:"vgs"` Devices []localcache.ExclusiveResource `json:"devices"` }
func GetNodeStorage ¶
func GetNodeStorage(node *corev1.Node) (*NodeStorage, error)
type ResourceSummary ¶
type ResourceSummary struct {
// contains filtered or unexported fields
}
func ReportNodeAllocationRate ¶
func ReportNodeAllocationRate(aamap map[string]AllocAmount) (rs []ResourceSummary)
type VolumeRequest ¶
type VolumeRequest struct {
Volumes []Volume `json:"volumes"`
}
func GetPodStorage ¶
func GetPodStorage(pod *corev1.Pod) *VolumeRequest
Click to show internal directories.
Click to hide internal directories.