Documentation ¶
Index ¶
- Constants
- func ClearPodUnscheduledAnno(pod *corev1.Pod)
- func GenerateValidPodsFromAppResources(client externalclientset.Interface, appname string, resources ResourceTypes) ([]*corev1.Pod, error)
- func GetAndSetSchedulerConfig(schedulerConfig string) (*config.CompletedConfig, error)
- func GetRecorderFactory(cc *schedconfig.CompletedConfig) profile.RecorderFactory
- func GetValidPodExcludeDaemonSet(resources ResourceTypes) ([]*corev1.Pod, error)
- func InitKubeSchedulerConfiguration(opts *schedoptions.Options) (*schedconfig.CompletedConfig, error)
- func IsPodMarkedUnscheduledAnno(pod *corev1.Pod) bool
- func MakePodUnassigned(oldPod *corev1.Pod) (newPod *corev1.Pod)
- func MarkPodUnscheduledAnno(pod *corev1.Pod)
- func MatchAndSetLocalStorageAnnotationOnNode(nodes []*corev1.Node, dir string)
- func RemovePodsByIndex(s []*corev1.Pod, index int) []*corev1.Pod
- func Simulate(cluster ResourceTypes, apps []AppResource, opts ...Option) (*simontype.SimulateResult, error)
- type AppResource
- type Interface
- type Item
- type Option
- type PriorityQueue
- type ResourceTypes
- type Simulator
- func (sim *Simulator) Close()
- func (sim *Simulator) ClusterAnalysis(tag string) (utils.FragAmount, []utils.ResourceSummary)
- func (sim *Simulator) ClusterGpuFragReport()
- func (sim *Simulator) DescheduleCluster() []simontype.UnscheduledPod
- func (sim *Simulator) ExportNodeSnapshotInCSV(filePath string)
- func (sim *Simulator) ExportPodSnapshotInCSV(filePath string)
- func (sim *Simulator) ExportPodSnapshotInYaml(unschedulePods []simontype.UnscheduledPod, filePath string)
- func (sim *Simulator) GetClusterNodeStatus() []simontype.NodeStatus
- func (sim *Simulator) GetCustomConfig() v1alpha1.CustomConfig
- func (sim *Simulator) NodeGpuFragAmount(nodeRes simontype.NodeResource) utils.FragAmount
- func (sim *Simulator) NodeGpuFragAmountMap(nodeResourceMap map[string]simontype.NodeResource) map[string]utils.FragAmount
- func (sim *Simulator) RecordNodeTotalResource(nodes []*corev1.Node) (int64, int64)
- func (sim *Simulator) RecordPodTotalResourceReq(pods []*corev1.Pod) (int64, int64)
- func (sim *Simulator) ReportFragBasedOnSkyline()
- func (sim *Simulator) RunCluster(cluster ResourceTypes) ([]simontype.UnscheduledPod, error)
- func (sim *Simulator) RunWorkloadInflationEvaluation(tag string)
- func (sim *Simulator) ScheduleApp(apps AppResource) ([]simontype.UnscheduledPod, error)
- func (sim *Simulator) SchedulePods(pods []*corev1.Pod) []simontype.UnscheduledPod
- func (sim *Simulator) SetSkylinePods()
- func (sim *Simulator) SetTypicalPods()
- func (sim *Simulator) SetWorkloadPods(pods []*corev1.Pod)
- func (sim *Simulator) SortClusterPods(pods []*corev1.Pod)
- func (sim *Simulator) TunePodsByNodeTotalResource(pods []*corev1.Pod, cfg v1alpha1.WorkloadTuningConfig) []*corev1.Pod
Constants ¶
const ( TagInitSchedule = "InitSchedule" TagPostEviction = "PostEviction" TagPostDeschedule = "PostDeschedule" TagScheduleInflation = "ScheduleInflation" TagDescheduleInflation = "DescheduleInflation" )
const ( DeschedulePolicyCosSim = "cosSim" DeschedulePolicyFragOnePod = "fragOnePod" DeschedulePolicyFragMultiPod = "fragMultiPod" )
Variables ¶
This section is empty.
Functions ¶
func ClearPodUnscheduledAnno ¶
func GenerateValidPodsFromAppResources ¶
func GenerateValidPodsFromAppResources(client externalclientset.Interface, appname string, resources ResourceTypes) ([]*corev1.Pod, error)
GenerateValidPodsFromAppResources generate valid pods from resources
func GetAndSetSchedulerConfig ¶
func GetAndSetSchedulerConfig(schedulerConfig string) (*config.CompletedConfig, error)
GetAndSetSchedulerConfig gets scheduler CompletedConfig and sets the list of scheduler bind plugins to Simon.
func GetRecorderFactory ¶
func GetRecorderFactory(cc *schedconfig.CompletedConfig) profile.RecorderFactory
func GetValidPodExcludeDaemonSet ¶
func GetValidPodExcludeDaemonSet(resources ResourceTypes) ([]*corev1.Pod, error)
GetValidPodExcludeDaemonSet gets valid pod by resources exclude DaemonSet that needs to be handled specially
func InitKubeSchedulerConfiguration ¶
func InitKubeSchedulerConfiguration(opts *schedoptions.Options) (*schedconfig.CompletedConfig, error)
func MarkPodUnscheduledAnno ¶
MarkPodUnscheduledAnno will directly modify the input and add an unscheduled annotation
func MatchAndSetLocalStorageAnnotationOnNode ¶
MatchAndSetLocalStorageAnnotationOnNode add storage information configured by json file, belonging to the node that matches the json file name, to annotation of this node
func Simulate ¶
func Simulate(cluster ResourceTypes, apps []AppResource, opts ...Option) (*simontype.SimulateResult, error)
Simulate is used for simulating and deploying apps in a cluster. It takes in the cluster and apps generated by the user as parameters, and deploys the apps in order. Return Values 1. If error is not empty, the function execution failed. 2. If error is empty, the function executes successfully and the SimulateResult information can be used to get the cluster simulation information. The SimulateResult information includes: 1. UnscheduledPods - represents unscheduled Pods. If the value is empty, it means that the simulation scheduling was successful. 2. NodeStatus - will record the Pod situation on each Node in detail.
Types ¶
type AppResource ¶
type AppResource struct { Name string Resource ResourceTypes }
type Interface ¶
type Interface interface { RunCluster(cluster ResourceTypes) ([]simontype.UnscheduledPod, error) ScheduleApp(AppResource) ([]simontype.UnscheduledPod, error) SchedulePods(pods []*corev1.Pod) []simontype.UnscheduledPod ClusterAnalysis(tag string) (utils.FragAmount, []utils.ResourceSummary) ClusterGpuFragReport() GetClusterNodeStatus() []simontype.NodeStatus SetWorkloadPods(pods []*corev1.Pod) SetTypicalPods() SetSkylinePods() RecordPodTotalResourceReq(pods []*corev1.Pod) (int64, int64) RecordNodeTotalResource(nodes []*corev1.Node) (int64, int64) TunePodsByNodeTotalResource(pods []*corev1.Pod, config v1alpha1.WorkloadTuningConfig) []*corev1.Pod ExportPodSnapshotInYaml(unschedulePods []simontype.UnscheduledPod, filePath string) ExportNodeSnapshotInCSV(filePath string) ExportPodSnapshotInCSV(filePath string) SortClusterPods(pods []*corev1.Pod) RunWorkloadInflationEvaluation(tag string) GetCustomConfig() v1alpha1.CustomConfig DescheduleCluster() []simontype.UnscheduledPod Close() }
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
An Item is something we manage in a priority queue.
type Option ¶
type Option func(*simulatorOptions)
Option configures a Simulator
func WithCustomConfig ¶
func WithCustomConfig(customConfig v1alpha1.CustomConfig) Option
func WithKubeConfig ¶
WithKubeConfig sets kubeconfig for Simulator, the default value is ""
func WithSchedulerConfig ¶
WithSchedulerConfig sets schedulerConfig for Simulator, the default value is ""
type PriorityQueue ¶
type PriorityQueue []*Item
A PriorityQueue implements heap.Interface and holds Items.
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)
type ResourceTypes ¶
type ResourceTypes struct { Nodes []*corev1.Node Pods []*corev1.Pod DaemonSets []*appsv1.DaemonSet StatefulSets []*appsv1.StatefulSet Deployments []*appsv1.Deployment ReplicationControllers []*corev1.ReplicationController ReplicaSets []*appsv1.ReplicaSet Services []*corev1.Service PersistentVolumeClaims []*corev1.PersistentVolumeClaim StorageClasss []*storagev1.StorageClass PodDisruptionBudgets []*policyv1beta1.PodDisruptionBudget Jobs []*batchv1.Job CronJobs []*batchv1beta1.CronJob }
func CreateClusterResourceFromClient ¶
func CreateClusterResourceFromClient(client externalclientset.Interface) (ResourceTypes, error)
CreateClusterResourceFromClient returns a ResourceTypes struct by kube-client that connects a real cluster
func CreateClusterResourceFromClusterConfig ¶
func CreateClusterResourceFromClusterConfig(path string) (ResourceTypes, error)
CreateClusterResourceFromClusterConfig return a ResourceTypes struct based on the cluster config
func GetObjectFromYamlContent ¶
func GetObjectFromYamlContent(ymlStr []string) (ResourceTypes, error)
GetObjectFromYamlContent decodes the yaml content and returns the kubernetes objects
type Simulator ¶
type Simulator struct {
// contains filtered or unexported fields
}
Simulator is used to simulate a cluster and pods scheduling
func (*Simulator) ClusterAnalysis ¶
func (sim *Simulator) ClusterAnalysis(tag string) (utils.FragAmount, []utils.ResourceSummary)
func (*Simulator) ClusterGpuFragReport ¶
func (sim *Simulator) ClusterGpuFragReport()
ClusterGpuFragReport Reports the Gpu Frag Amount of all nodes
func (*Simulator) DescheduleCluster ¶
func (sim *Simulator) DescheduleCluster() []simontype.UnscheduledPod
func (*Simulator) ExportNodeSnapshotInCSV ¶
func (*Simulator) ExportPodSnapshotInCSV ¶
func (*Simulator) ExportPodSnapshotInYaml ¶
func (sim *Simulator) ExportPodSnapshotInYaml(unschedulePods []simontype.UnscheduledPod, filePath string)
func (*Simulator) GetClusterNodeStatus ¶
func (sim *Simulator) GetClusterNodeStatus() []simontype.NodeStatus
func (*Simulator) GetCustomConfig ¶
func (sim *Simulator) GetCustomConfig() v1alpha1.CustomConfig
func (*Simulator) NodeGpuFragAmount ¶
func (sim *Simulator) NodeGpuFragAmount(nodeRes simontype.NodeResource) utils.FragAmount
func (*Simulator) NodeGpuFragAmountMap ¶
func (sim *Simulator) NodeGpuFragAmountMap(nodeResourceMap map[string]simontype.NodeResource) map[string]utils.FragAmount
func (*Simulator) RecordNodeTotalResource ¶
RecordNodeTotalResource will record the total resources of all nodes, and return the list: [total milli cpu of all nodes, total milli gpu of all nodes]
func (*Simulator) RecordPodTotalResourceReq ¶
RecordPodTotalResourceReq will record the total resource requests of all pods, and return the list: [total milli cpu request of all pods, total milli gpu request of all pods]
func (*Simulator) ReportFragBasedOnSkyline ¶
func (sim *Simulator) ReportFragBasedOnSkyline()
func (*Simulator) RunCluster ¶
func (sim *Simulator) RunCluster(cluster ResourceTypes) ([]simontype.UnscheduledPod, error)
RunCluster with real client in a production cluster or fake client in a simulated cluster.
func (*Simulator) RunWorkloadInflationEvaluation ¶
func (*Simulator) ScheduleApp ¶
func (sim *Simulator) ScheduleApp(apps AppResource) ([]simontype.UnscheduledPod, error)
func (*Simulator) SchedulePods ¶
func (sim *Simulator) SchedulePods(pods []*corev1.Pod) []simontype.UnscheduledPod
func (*Simulator) SetSkylinePods ¶
func (sim *Simulator) SetSkylinePods()
func (*Simulator) SetTypicalPods ¶
func (sim *Simulator) SetTypicalPods()
func (*Simulator) SetWorkloadPods ¶
func (*Simulator) SortClusterPods ¶
func (*Simulator) TunePodsByNodeTotalResource ¶
func (sim *Simulator) TunePodsByNodeTotalResource(pods []*corev1.Pod, cfg v1alpha1.WorkloadTuningConfig) []*corev1.Pod
TunePodsByNodeTotalResource prune or append pods to match the cfg.Ratio * (cluster_GPU_capacity)