scheduler

package
v0.0.0-...-7594f3d Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobQueuing    = "queuing"
	JobProcessing = "processing"
	JobSucceed    = "succeed"
	JobFailed     = "failed"
	JobStopped    = "stopped"
)
View Source
const (
	ResourceNvidiaGPU v1.ResourceName = "nvdia.com/gpu"
)

Variables

This section is empty.

Functions

func SchedulerEmulatorReviewPrettyPrint

func SchedulerEmulatorReviewPrettyPrint(r *SchedulerEmulatorReview, verbose bool)

func SchedulerEmulatorReviewPrint

func SchedulerEmulatorReviewPrint(r *SchedulerEmulatorReview, verbose bool, format string) error

func SchedulerEmulatorReviewPrintJson

func SchedulerEmulatorReviewPrintJson(r *SchedulerEmulatorReview) error

func SchedulerEmulatorReviewPrintYaml

func SchedulerEmulatorReviewPrintYaml(r *SchedulerEmulatorReview) error

Types

type AccessSwitch

type AccessSwitch struct {
	Name         string   `json:"name""`
	NodeNumber   int32    `json:"nodeNumber"`
	NodeNameList []string `json:"nodeNameList"`
}

type AccessSwitchSpec

type AccessSwitchSpec struct {
	MinNode        int32 `json:"minNode"`
	MaxNode        int32 `json:"maxNode"`
	PredictionNode int32 `json:"predictionNode"`
}

type AccessSwitchStatus

type AccessSwitchStatus struct {
	PredictionNode int32           `json:"predictionNode"`
	NetType        string          `json:"netType"`
	Access         []*AccessSwitch `json:"access"`
}

type AddNodesEmulator

type AddNodesEmulator struct {
	Name string
	Func func(nodeConfig *utils.NodeConfig, ks *Kubesim) (*utils.NodeInfoList, error)
	// contains filtered or unexported fields
}

func NewAddNodesEmulator

func NewAddNodesEmulator(clientset clientset.Interface, ks *Kubesim) *AddNodesEmulator

func (AddNodesEmulator) AddNodesHandler

func (e AddNodesEmulator) AddNodesHandler(nodeConfig *utils.NodeConfig) (*utils.NodeInfoList, error)

type AppsEmulator

type AppsEmulator struct {
	Name string
	Func func(nodes []utils.NodeConfig, apps utils.MutiAppsRequest, ks *Kubesim) *utils.SimulatorJob
	// contains filtered or unexported fields
}

func NewAppsEmulator

func NewAppsEmulator(clientset clientset.Interface, ks *Kubesim) *AppsEmulator

func (AppsEmulator) AppsHandler

func (e AppsEmulator) AppsHandler(nodes []utils.NodeConfig, apps utils.MutiAppsRequest) *utils.SimulatorJob

type DeleteNodesEmulator

type DeleteNodesEmulator struct {
	Name string
	Func func(S *Kubesim) error
	// contains filtered or unexported fields
}

func NewDeleteNodesEmulator

func NewDeleteNodesEmulator(clientset clientset.Interface, ks *Kubesim) *DeleteNodesEmulator

func (DeleteNodesEmulator) DeleteNodesHandler

func (e DeleteNodesEmulator) DeleteNodesHandler() error

type DeprecatedAppsEmulator

type DeprecatedAppsEmulator struct {
	Name string
	Func func(nodes []utils.NodeConfig, apps utils.MutiAppsRequest, ks *Kubesim) (*SchedulerEmulatorReviewList, error)
	// contains filtered or unexported fields
}

func NewDeprecatedAppsEmulator

func NewDeprecatedAppsEmulator(clientset clientset.Interface, ks *Kubesim) *DeprecatedAppsEmulator

func (DeprecatedAppsEmulator) DeprecatedAppsHandler

type DeprecatedPredictionEmulator

type DeprecatedPredictionEmulator struct {
	Name string
	Func func(nodes []utils.NodeConfig, apps utils.MutiAppsRequest, ks *Kubesim) (*SchedulerPrediction, error)
	// contains filtered or unexported fields
}

func NewDeprecatedPredictionEmulator

func NewDeprecatedPredictionEmulator(clientset clientset.Interface, ks *Kubesim) *DeprecatedPredictionEmulator

func (DeprecatedPredictionEmulator) DeprecatedPredictionHandler

func (e DeprecatedPredictionEmulator) DeprecatedPredictionHandler(nodes []utils.NodeConfig, apps utils.MutiAppsRequest) (*SchedulerPrediction, error)

type EmulatorReport

type EmulatorReport struct {
	Name string
	Func func(id string, ks *Kubesim) (*JobReport, error)
	// contains filtered or unexported fields
}

func NewEmulatorReport

func NewEmulatorReport(clientset clientset.Interface, ks *Kubesim) *EmulatorReport

func (EmulatorReport) EmulatorReportHandler

func (e EmulatorReport) EmulatorReportHandler(id string) (*JobReport, error)

type FailReasonSummary

type FailReasonSummary struct {
	Reason string `json:"reason"`
	Count  int    `json:"count"`
}

type HorizontalEmulator

type HorizontalEmulator struct {
	Name string
	Func func(nodes []utils.NodeConfig, apps utils.MutiAppsRequest, ks *Kubesim) (*utils.SimulatorJob, error)
	// contains filtered or unexported fields
}

func NewHorizontalEmulator

func NewHorizontalEmulator(clientset clientset.Interface, ks *Kubesim) *HorizontalEmulator

func (HorizontalEmulator) HorizontalHandler

func (e HorizontalEmulator) HorizontalHandler(nodes []utils.NodeConfig, apps utils.MutiAppsRequest) (*utils.SimulatorJob, error)

type JobReport

type JobReport struct {
	JobID          string                    `json:"job"`
	Status         string                    `json:"status"`
	Report         []SchedulerEmulatorReview `json:"report"`
	PredictionNode *PredictionNodeReview     `json:"prediction"`
}

type Kubesim

type Kubesim struct {

	// real cluster client
	KubeClient externalclientset.Interface

	// recorder used to send event to real cluster
	Recorder    record.EventRecorder
	Broadcaster record.EventBroadcaster
	// contains filtered or unexported fields
}

func New

func New(addStrategy string, cc *schedconfig.CompletedConfig, client, kubeClient externalclientset.Interface, outOfTreeRegistryOptions ...utils.Option) (*Kubesim, error)

Create new cluster capacity analysis The analysis is completely independent of apiserver so no need for kubeconfig nor for apiserver url

func (*Kubesim) AddNodes

func (ks *Kubesim) AddNodes(nodeConfig *utils.NodeConfig) (map[string][]string, *utils.NodeInfoList, error)

Create simulator node

func (*Kubesim) Bind

func (ks *Kubesim) Bind(ctx context.Context, state *framework.CycleState, p *v1.Pod, nodeName string, schedulerName string) *framework.Status

func (*Kubesim) CSIDriverWatch

func (ks *Kubesim) CSIDriverWatch(client externalclientset.Interface) error

func (*Kubesim) CSINodeWatch

func (ks *Kubesim) CSINodeWatch(client externalclientset.Interface) error

func (*Kubesim) CleanPendingPod

func (ks *Kubesim) CleanPendingPod(pod *v1.Pod) error

Clean simulated pending pod

func (*Kubesim) CleanPod

func (ks *Kubesim) CleanPod() error

Clean simulated pod

func (*Kubesim) CleanStatusPods

func (ks *Kubesim) CleanStatusPods()

clean status pods

func (*Kubesim) Close

func (ks *Kubesim) Close()

func (*Kubesim) CreateApps

func (ks *Kubesim) CreateApps(appgroup *utils.AppGroup, key string) (*SchedulerPrediction, error)

func (*Kubesim) CreateAppsPod

func (ks *Kubesim) CreateAppsPod(pod *v1.Pod) error

create apps pod

func (*Kubesim) CreateFakeNode

func (ks *Kubesim) CreateFakeNode(nodeConfig *utils.NodeConfig, predictionNode int) (map[string][]string, error)

func (*Kubesim) DeleteAppsPod

func (ks *Kubesim) DeleteAppsPod(namespace, name string) error

delete apps pod by pod name

func (*Kubesim) DeleteNodes

func (ks *Kubesim) DeleteNodes() error

Delete simulator node

func (*Kubesim) GetAppPod

func (ks *Kubesim) GetAppPod(namespace, label string) ([]v1.Pod, error)

get apps pod by label

func (*Kubesim) GetAppsPod

func (se *Kubesim) GetAppsPod(podsConfig *utils.PodsConfig) ([]*v1.Pod, []*v1.Pod)

get apps newpod and oldpods

func (*Kubesim) GetNodeInfo

func (ks *Kubesim) GetNodeInfo() (*[]utils.NodeInfo, error)

get nodeinfo

func (*Kubesim) GetPod

func (se *Kubesim) GetPod(name, namespace string) (*v1.Pod, error)

get pod by pod name and namespace

func (*Kubesim) HorizontalEmulator

func (ks *Kubesim) HorizontalEmulator(appgroup *utils.AppGroup, key string) (*SchedulerEmulatorReviewList, error)

func (*Kubesim) ListNodes

func (ks *Kubesim) ListNodes() (*utils.NodeInfoList, error)

List simulator node

func (*Kubesim) NewBindPlugin

func (ks *Kubesim) NewBindPlugin(schedulerName string, configuration runtime.Object, f framework.Handle) (framework.Plugin, error)

func (*Kubesim) NodeWatch

func (ks *Kubesim) NodeWatch(client externalclientset.Interface) error

func (*Kubesim) PVCWatch

func (ks *Kubesim) PVCWatch(client externalclientset.Interface) error

func (*Kubesim) PVWatch

func (ks *Kubesim) PVWatch(client externalclientset.Interface) error

func (*Kubesim) PodWatch

func (ks *Kubesim) PodWatch(client externalclientset.Interface) error

func (*Kubesim) PredictionEmulator

func (ks *Kubesim) PredictionEmulator(appgroup *utils.AppGroup, key string) (*SchedulerEmulatorReviewList, error)

func (*Kubesim) Report

func (ks *Kubesim) Report() *SchedulerEmulatorReview

func (*Kubesim) Run

func (ks *Kubesim) Run() error

func (*Kubesim) SavePrediction

func (ks *Kubesim) SavePrediction(access map[string][]string, key string, minNode, maxNode, predictionNode int, reportList *SchedulerEmulatorReviewList)

func (*Kubesim) SchedulerPod

func (ks *Kubesim) SchedulerPod() error

Scheduler a simulated pod

func (*Kubesim) StorageClassWatch

func (ks *Kubesim) StorageClassWatch(client externalclientset.Interface) error

func (*Kubesim) SyncWithClient

func (ks *Kubesim) SyncWithClient(client externalclientset.Interface) error

func (*Kubesim) Update

func (ks *Kubesim) Update(pod *v1.Pod, podCondition *v1.PodCondition, schedulerName string) error

func (*Kubesim) UpdatePodRequest

func (ks *Kubesim) UpdatePodRequest(pod *v1.Pod, replicas int32) *Kubesim

Pod request

func (*Kubesim) VerticalEmulator

func (ks *Kubesim) VerticalEmulator(appgroup *utils.AppGroup, key string) (*SchedulerEmulatorReviewList, error)

func (*Kubesim) VolumeAttachmentsWatch

func (ks *Kubesim) VolumeAttachmentsWatch(client externalclientset.Interface) error

type ListNodeInfoEmulator

type ListNodeInfoEmulator struct {
	Name string
	Func func(ks *Kubesim) (*[]utils.NodeInfo, error)
	// contains filtered or unexported fields
}

func NewListNodeInfoEmulator

func NewListNodeInfoEmulator(clientset clientset.Interface, ks *Kubesim) *ListNodeInfoEmulator

func (ListNodeInfoEmulator) ListNodeInfoHandler

func (e ListNodeInfoEmulator) ListNodeInfoHandler() (*[]utils.NodeInfo, error)

type ListNodesEmulator

type ListNodesEmulator struct {
	Name string
	Func func(ks *Kubesim) (*utils.NodeInfoList, error)
	// contains filtered or unexported fields
}

func NewListNodesEmulator

func NewListNodesEmulator(clientset clientset.Interface, ks *Kubesim) *ListNodesEmulator

func (ListNodesEmulator) ListNodesHandler

func (e ListNodesEmulator) ListNodesHandler() (*utils.NodeInfoList, error)

type PredictionEmulator

type PredictionEmulator struct {
	Name string
	Func func(nodes []utils.NodeConfig, apps utils.MutiAppsRequest, ks *Kubesim) *utils.SimulatorJob
	// contains filtered or unexported fields
}

func NewPredictionEmulator

func NewPredictionEmulator(clientset clientset.Interface, ks *Kubesim) *PredictionEmulator

func (PredictionEmulator) PredictionHandler

func (e PredictionEmulator) PredictionHandler(nodes []utils.NodeConfig, apps utils.MutiAppsRequest) *utils.SimulatorJob

type PredictionNodeReview

type PredictionNodeReview struct {
	metav1.TypeMeta
	Spec   AccessSwitchSpec   `json:"spec"`
	Status AccessSwitchStatus `json:"status"`
}

type ReplicasOnNode

type ReplicasOnNode struct {
	NodeName string `json:"nodeName"`
	Replicas int    `json:"replicas"`
}

type Requirements

type Requirements struct {
	PodName       string            `json:"usName"`
	Resources     *Resources        `json:"resources"`
	NodeSelectors map[string]string `json:"nodeSelectors"`
}

type Resources

type Resources struct {
	PrimaryResources v1.ResourceList           `json:"primaryResources"`
	ScalarResources  map[v1.ResourceName]int64 `json:"scalarResources"`
}

type SchedulerEmulatorReview

type SchedulerEmulatorReview struct {
	metav1.TypeMeta
	Spec   SchedulerEmulatorReviewSpec   `json:"spec"`
	Status SchedulerEmulatorReviewStatus `json:"status"`
}

func GetReport

func GetReport(pods []*v1.Pod, status Status, desiredReplicas int32) *SchedulerEmulatorReview

type SchedulerEmulatorReviewList

type SchedulerEmulatorReviewList struct {
	ReportList []SchedulerEmulatorReview `json:"reportList"`
}

type SchedulerEmulatorReviewResult

type SchedulerEmulatorReviewResult struct {
	UsName string `json:"usName"`
	// numbers of replicas on nodes
	ReplicasOnNodes []*ReplicasOnNode `json:"replicasOnNodes"`
	// reason why no more pods could schedule (if any on this node)
	FailSummary []FailReasonSummary `json:"failSummary"`
}

type SchedulerEmulatorReviewScheduleFailReason

type SchedulerEmulatorReviewScheduleFailReason struct {
	Type    string `json:"Type"`
	Message string `json:"Message"`
}

type SchedulerEmulatorReviewSpec

type SchedulerEmulatorReviewSpec struct {

	// desired number of replicas that should be scheduled
	// +optional
	DesiredReplicas int32 `json:"desiredReplicas"`

	PodRequirements []*Requirements `json:"podRequirements"`
}

type SchedulerEmulatorReviewStatus

type SchedulerEmulatorReviewStatus struct {
	CreationTimestamp time.Time `json:"creationTimestamp"`
	// actual number of replicas that could schedule
	Replicas int32 `json:"replicas"`

	Reason *SchedulerEmulatorReviewScheduleFailReason `json:"reason"`

	// per node information about the scheduling simulation
	Pods []*SchedulerEmulatorReviewResult `json:"pods"`
}

type SchedulerPrediction

type SchedulerPrediction struct {
	SuccessAppsName      []string                     `json:"successAppsName"`
	SuccessAppsCount     int32                        `json:"successAppsCount"`
	FailedAppsCount      int32                        `json:"failedAppsCount"`
	FirstAppfailedReason string                       `json:"firstAppFailedReason"`
	PredictionGo         bool                         `json:"predictionGo"`
	ReportList           *SchedulerEmulatorReviewList `json:"reportList"`
}

type Status

type Status struct {
	Pods       []*v1.Pod
	StopReason string
}

capture all scheduled pods with reason why the analysis could not continue

type VerticalEmulator

type VerticalEmulator struct {
	Name string
	Func func(nodes []utils.NodeConfig, apps utils.MutiAppsRequest, ks *Kubesim) (*utils.SimulatorJob, error)
	// contains filtered or unexported fields
}

func NewVerticalEmulator

func NewVerticalEmulator(clientset clientset.Interface, ks *Kubesim) *VerticalEmulator

func (VerticalEmulator) VerticalHandler

func (e VerticalEmulator) VerticalHandler(nodes []utils.NodeConfig, apps utils.MutiAppsRequest) (*utils.SimulatorJob, error)

Jump to

Keyboard shortcuts

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