reservation

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AnnotationReservePod indicates whether the pod is a reserved pod.
	AnnotationReservePod = extension.SchedulingDomainPrefix + "/reserve-pod"
	// AnnotationReservationName indicates the name of the reservation.
	AnnotationReservationName = extension.SchedulingDomainPrefix + "/reservation-name"
	// AnnotationReservationNode indicates the node name if the reservation specifies a node.
	AnnotationReservationNode = extension.SchedulingDomainPrefix + "/reservation-node"
	// AnnotationReservationResizeAllocatable indicates the desired allocatable are to be updated.
	AnnotationReservationResizeAllocatable = extension.SchedulingDomainPrefix + "/reservation-resize-allocatable"
)

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 GetReservationRestrictedResources added in v1.5.0

func GetReservationRestrictedResources(allocatableResources []corev1.ResourceName, options *extension.ReservationRestrictedOptions) []corev1.ResourceName

func GetReservationSchedulerName

func GetReservationSchedulerName(r *schedulingv1alpha1.Reservation) string

func GetReservePodNamespacedName added in v1.3.0

func GetReservePodNamespacedName(r *schedulingv1alpha1.Reservation) types.NamespacedName

func GetReservePodNodeName

func GetReservePodNodeName(pod *corev1.Pod) string

func IsObjValidActiveReservation

func IsObjValidActiveReservation(obj interface{}) bool

func IsReservationActive

func IsReservationActive(r *schedulingv1alpha1.Reservation) bool

IsReservationActive checks if the reservation is scheduled and its status is Available/Waiting (active to use).

func IsReservationAvailable

func IsReservationAvailable(r *schedulingv1alpha1.Reservation) bool

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

func IsReservationExpired

func IsReservationExpired(r *schedulingv1alpha1.Reservation) bool

func IsReservationFailed

func IsReservationFailed(r *schedulingv1alpha1.Reservation) bool

func IsReservationSucceeded

func IsReservationSucceeded(r *schedulingv1alpha1.Reservation) bool

func IsReservePod

func IsReservePod(pod *corev1.Pod) bool

func MatchObjectRef

func MatchObjectRef(pod *corev1.Pod, objRef *corev1.ObjectReference) bool

func MatchReservationControllerReference

func MatchReservationControllerReference(pod *corev1.Pod, controllerRef *schedulingv1alpha1.ReservationControllerReference) bool

func MatchReservationOwners

func MatchReservationOwners(pod *corev1.Pod, matchers []ReservationOwnerMatcher) bool

MatchReservationOwners checks if the scheduling pod matches the reservation's owner spec. `reservation.spec.owners` defines the DNF (disjunctive normal form) of ObjectReference, ControllerReference (extended), LabelSelector, which means multiple selectors are firstly ANDed and secondly ORed.

func NewReservationToPodEventHandler

func NewReservationToPodEventHandler(handler cache.ResourceEventHandler, filters ...func(obj interface{}) bool) cache.ResourceEventHandler

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 PodPriority added in v1.3.0

func PodPriority(r *schedulingv1alpha1.Reservation) int32

func SetReservationAvailable

func SetReservationAvailable(r *schedulingv1alpha1.Reservation, nodeName string) error

func SetReservationExpired

func SetReservationExpired(r *schedulingv1alpha1.Reservation)

func SetReservationResizeAllocatable added in v1.4.0

func SetReservationResizeAllocatable(obj metav1.Object, resizeAllocatable *ReservationResizeAllocatable) error

func SetReservationSucceeded

func SetReservationSucceeded(r *schedulingv1alpha1.Reservation)

func UpdateReservationResizeAllocatable added in v1.4.0

func UpdateReservationResizeAllocatable(obj metav1.Object, resources corev1.ResourceList) error

UpdateReservationResizeAllocatable replaces or add the resources to the resizeAllocatable.

func UpdateReservePodWithAllocatable added in v1.4.0

func UpdateReservePodWithAllocatable(reservePod *corev1.Pod, podRequests, allocatable corev1.ResourceList)

func ValidateReservation

func ValidateReservation(r *schedulingv1alpha1.Reservation) error

Types

type RequiredReservationAffinity added in v1.3.0

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

func GetRequiredReservationAffinity added in v1.3.0

func GetRequiredReservationAffinity(pod *corev1.Pod) (*RequiredReservationAffinity, error)

GetRequiredReservationAffinity returns the parsing result of pod's nodeSelector and nodeAffinity.

func (*RequiredReservationAffinity) Match added in v1.3.0

func (s *RequiredReservationAffinity) Match(node *corev1.Node) bool

Match checks whether the pod is schedulable onto nodes according to the requirements in both nodeSelector and nodeAffinity.

type ReservationOwnerMatcher added in v1.4.0

type ReservationOwnerMatcher struct {
	schedulingv1alpha1.ReservationOwner
	Selector labels.Selector
}

func ParseReservationOwnerMatchers added in v1.4.0

func ParseReservationOwnerMatchers(owners []schedulingv1alpha1.ReservationOwner) ([]ReservationOwnerMatcher, error)

func (*ReservationOwnerMatcher) Match added in v1.4.0

func (m *ReservationOwnerMatcher) Match(pod *corev1.Pod) bool

type ReservationResizeAllocatable added in v1.4.0

type ReservationResizeAllocatable struct {
	Resources corev1.ResourceList `json:"resources,omitempty"`
}

func GetReservationResizeAllocatable added in v1.4.0

func GetReservationResizeAllocatable(annotations map[string]string) (*ReservationResizeAllocatable, error)

type ReservationToPodEventHandler

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

ReservationToPodEventHandler can be used to handle reservation events with a pod event handler, which converts each reservation object into the corresponding reserve pod object.

e.g.
func registerReservationEventHandler(handle framework.Handle, podHandler podHandler) {
  extendedHandle, ok := handle.(frameworkext.ExtendedHandle)
  if !ok { // if not implement extendedHandle, ignore reservation events
    klog.V(3).Infof("registerReservationEventHandler aborted, cannot convert handle to frameworkext.ExtendedHandle, got %T", handle)
    return
  }
  extendedHandle.KoordinatorSharedInformerFactory().Scheduling().V1alpha1().Reservations().Informer().
 	 AddEventHandler(util.NewReservationToPodEventHandler(&podHandler, IsObjValidActiveReservation))
}

func (ReservationToPodEventHandler) OnAdd

func (r ReservationToPodEventHandler) OnAdd(obj interface{}, isInInitialList bool)

func (ReservationToPodEventHandler) OnDelete

func (r ReservationToPodEventHandler) OnDelete(obj interface{})

OnDelete calls DeleteFunc if it's not nil.

func (ReservationToPodEventHandler) OnUpdate

func (r ReservationToPodEventHandler) OnUpdate(oldObj, newObj interface{})

OnUpdate calls UpdateFunc if it's not nil.

Jump to

Keyboard shortcuts

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