reservation

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "Reservation" // the plugin name

	// ErrReasonNodeNotMatchReservation is the reason for node not matching which the reserve pod specifies.
	ErrReasonNodeNotMatchReservation = "node(s) didn't match the nodeName specified by reservation"
	// ErrReasonReservationNotFound is the reason for the reservation is not found and should not be used.
	ErrReasonReservationNotFound = "reservation is not found"
	// ErrReasonReservationFailed is the reason for the reservation is failed/expired and should not be used.
	ErrReasonReservationFailed = "reservation is failed"
	// ErrReasonReservationFailedToReserve is the reason for the assumed reservation does not match the pod any more.
	ErrReasonReservationFailedToReserve = "reservation failed to reserve and does not match any more"
	// SkipReasonNotReservation is the reason for pod does not match any reservation.
	SkipReasonNotReservation = "pod does not match any reservation"
)
View Source
const (
	// NodeNameIndex is the lookup name for the index function, which is to index by the status.nodeName field.
	NodeNameIndex string = "status.nodeName"
)

Variables

View Source
var (
	// AnnotationReservePod indicates whether the pod is a reserved pod.
	AnnotationReservePod = apiext.SchedulingDomainPrefix + "/reserve-pod"
	// AnnotationReservationName indicates the name of the reservation.
	AnnotationReservationName = apiext.SchedulingDomainPrefix + "/reservation-name"
	// AnnotationReservationNode indicates the node name if the reservation specifies a node.
	AnnotationReservationNode = apiext.SchedulingDomainPrefix + "/reservation-node"
)

Functions

func GetReservationKey

func GetReservationKey(r *schedulingv1alpha1.Reservation) string

func GetReservationNameFromReservePod

func GetReservationNameFromReservePod(pod *corev1.Pod) string

func GetReservationNodeName

func GetReservationNodeName(r *schedulingv1alpha1.Reservation) string

func GetReservationSchedulerName

func GetReservationSchedulerName(r *schedulingv1alpha1.Reservation) string

func GetReservePodKey

func GetReservePodKey(pod *corev1.Pod) string

func GetReservePodNodeName

func GetReservePodNodeName(pod *corev1.Pod) string

func IsReservationActive

func IsReservationActive(r *schedulingv1alpha1.Reservation) bool

IsReservationActive checks if the reservation is scheduled and its status is Available/Waiting.

func IsReservationExpired

func IsReservationExpired(r *schedulingv1alpha1.Reservation) bool

func IsReservationFailed

func IsReservationFailed(r *schedulingv1alpha1.Reservation) bool

func IsReservationScheduled

func IsReservationScheduled(r *schedulingv1alpha1.Reservation) bool

IsReservationScheduled checks if the reservation is scheduled on a node and its status is Available.

func IsReservePod

func IsReservePod(pod *corev1.Pod) bool

func New

func New(args runtime.Object, handle framework.Handle) (framework.Plugin, error)

func NewReservePod

func NewReservePod(r *schedulingv1alpha1.Reservation) *corev1.Pod

NewReservePod returns a fake pod set as the reservation's specifications. The reserve pod is only visible for the scheduler and does not make actual creation on nodes.

func SetReservationNodeName

func SetReservationNodeName(r *schedulingv1alpha1.Reservation, nodeName string)

func StatusNodeNameIndexFunc

func StatusNodeNameIndexFunc(obj interface{}) ([]string, error)

StatusNodeNameIndexFunc is an index function that indexes based on a reservation's status.nodeName

func ValidateReservation

func ValidateReservation(r *schedulingv1alpha1.Reservation) error

Types

type AvailableCache

type AvailableCache struct {
	// contains filtered or unexported fields
}

AvailableCache is for efficiently querying the reservation allocation results. Typical usages are as below: 1. check if a pod match any of available reservations (ownership and resource requirements). 2. check which nodes a pod match available reservation are at. 3. check which reservations are on a node.

func (*AvailableCache) Add

func (*AvailableCache) Delete

func (*AvailableCache) Get

func (a *AvailableCache) Get(key string) *reservationInfo

func (*AvailableCache) GetOnNode

func (a *AvailableCache) GetOnNode(nodeName string) []*reservationInfo

func (*AvailableCache) Len

func (a *AvailableCache) Len() int

type Hook

type Hook struct {
	// contains filtered or unexported fields
}

func NewHook

func NewHook() *Hook

func (*Hook) FilterHook

func (h *Hook) FilterHook(handle frameworkext.ExtendedHandle, cycleState *framework.CycleState, pod *corev1.Pod, nodeInfo *framework.NodeInfo) (*corev1.Pod, *framework.NodeInfo, bool)

func (*Hook) Name

func (h *Hook) Name() string

func (*Hook) PreFilterHook

func (h *Hook) PreFilterHook(handle frameworkext.ExtendedHandle, cycleState *framework.CycleState, pod *corev1.Pod) (*corev1.Pod, bool)

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (*Plugin) Bind

func (p *Plugin) Bind(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) *framework.Status

Bind fake binds reserve pod and mark corresponding reservation as Available. NOTE: This Bind plugin should get called before DefaultBinder; plugin order should be configured.

func (*Plugin) Filter

func (p *Plugin) Filter(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeInfo *framework.NodeInfo) *framework.Status

Filter only processes pods either the pod is a reserve pod or a pod can allocate reserved resources on the node.

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) PostFilter

func (p *Plugin) PostFilter(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, filteredNodeStatusMap framework.NodeToStatusMap) (*framework.PostFilterResult, *framework.Status)

func (*Plugin) PreBind

func (p *Plugin) PreBind(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) *framework.Status

func (*Plugin) PreFilter

func (p *Plugin) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod) *framework.Status

PreFilter checks if the pod is a reserve pod. If it is, update cycle state to annotate reservation scheduling. Also do validations in this phase.

func (*Plugin) PreFilterExtensions

func (p *Plugin) PreFilterExtensions() framework.PreFilterExtensions

func (*Plugin) Reserve

func (p *Plugin) Reserve(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) *framework.Status

func (*Plugin) Score

func (p *Plugin) Score(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) (int64, *framework.Status)

func (*Plugin) ScoreExtensions

func (p *Plugin) ScoreExtensions() framework.ScoreExtensions

func (*Plugin) Unreserve

func (p *Plugin) Unreserve(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string)

Jump to

Keyboard shortcuts

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