scheduler

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultScheduler

func NewDefaultScheduler(log logr.Logger) *defaultScheduler

NewDefaultScheduler creates a new default scheduler

Types

type ClusterState

type ClusterState struct {
	// Nodes is a map between node name and k8s Node obj
	Nodes map[string]*corev1.Node
	// MaintenanceInProgress hold all NodeMaintenance objects that are currently in progress
	MaintenanceInProgress []*maintenancev1.NodeMaintenance
	// MaintenancePending holds all NodeMaintenance that are pending to be scheduled
	MaintenancePending []*maintenancev1.NodeMaintenance
}

ClusterState represent the state of the cluster for Scheduler

func NewClusterState

func NewClusterState(nodes []*corev1.Node, nodeMaintenances []*maintenancev1.NodeMaintenance) *ClusterState

NewClusterState returns a new ClusterState

type Scheduler

type Scheduler interface {
	// Schedule returns the next set of NodeMaintenance objects to be scheduled.
	Schedule(clusterState *ClusterState, schedulerCtx *SchedulerContext) []*maintenancev1.NodeMaintenance
}

Scheduler defines an interface for scheduling NodeMaintenance requests

type SchedulerContext

type SchedulerContext struct {
	// AvailableSlots is the number of Maintenance slots available
	AvailableSlots int
	// CanBecomeUnavailable is the number of nodes that can become unavailable during scheduling
	CanBecomeUnavailable int
	// CandidateNodes is the Set of nodes that must be considered for maintenance
	CandidateNodes sets.Set[string]
	// CandidateMaintenance is a list of NodeMaintenance that must be considered for scheduling
	CandidateMaintenance []*maintenancev1.NodeMaintenance
}

SchedulerContext contains pre-scheduling information

Jump to

Keyboard shortcuts

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