Documentation
¶
Index ¶
- Constants
- Variables
- func GetReservationKey(r *schedulingv1alpha1.Reservation) string
- func GetReservationNameFromReservePod(pod *corev1.Pod) string
- func GetReservationNodeName(r *schedulingv1alpha1.Reservation) string
- func GetReservationSchedulerName(r *schedulingv1alpha1.Reservation) string
- func GetReservePodKey(pod *corev1.Pod) string
- func GetReservePodNodeName(pod *corev1.Pod) string
- func IsReservationActive(r *schedulingv1alpha1.Reservation) bool
- func IsReservationExpired(r *schedulingv1alpha1.Reservation) bool
- func IsReservationFailed(r *schedulingv1alpha1.Reservation) bool
- func IsReservationScheduled(r *schedulingv1alpha1.Reservation) bool
- func IsReservePod(pod *corev1.Pod) bool
- func New(args runtime.Object, handle framework.Handle) (framework.Plugin, error)
- func NewReservePod(r *schedulingv1alpha1.Reservation) *corev1.Pod
- func SetReservationNodeName(r *schedulingv1alpha1.Reservation, nodeName string)
- func StatusNodeNameIndexFunc(obj interface{}) ([]string, error)
- func ValidateReservation(r *schedulingv1alpha1.Reservation) error
- type AvailableCache
- type Hook
- type Plugin
- func (p *Plugin) Bind(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, ...) *framework.Status
- func (p *Plugin) Filter(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, ...) *framework.Status
- func (p *Plugin) Name() string
- func (p *Plugin) PostFilter(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, ...) (*framework.PostFilterResult, *framework.Status)
- func (p *Plugin) PreBind(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, ...) *framework.Status
- func (p *Plugin) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod) *framework.Status
- func (p *Plugin) PreFilterExtensions() framework.PreFilterExtensions
- func (p *Plugin) Reserve(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, ...) *framework.Status
- func (p *Plugin) Score(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, ...) (int64, *framework.Status)
- func (p *Plugin) ScoreExtensions() framework.ScoreExtensions
- func (p *Plugin) Unreserve(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, ...)
Constants ¶
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" )
const ( // NodeNameIndex is the lookup name for the index function, which is to index by the status.nodeName field. NodeNameIndex string = "status.nodeName" )
Variables ¶
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 GetReservationNodeName ¶
func GetReservationNodeName(r *schedulingv1alpha1.Reservation) string
func GetReservationSchedulerName ¶
func GetReservationSchedulerName(r *schedulingv1alpha1.Reservation) string
func GetReservePodKey ¶
func GetReservePodNodeName ¶
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 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 ¶
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 (a *AvailableCache) Add(r *schedulingv1alpha1.Reservation)
func (*AvailableCache) Delete ¶
func (a *AvailableCache) Delete(r *schedulingv1alpha1.Reservation)
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 (*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) 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) PostFilter ¶
func (p *Plugin) PostFilter(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, filteredNodeStatusMap framework.NodeToStatusMap) (*framework.PostFilterResult, *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) ScoreExtensions ¶
func (p *Plugin) ScoreExtensions() framework.ScoreExtensions