Skip to content

Commit

Permalink
scheduler: refine reservation ignored
Browse files Browse the repository at this point in the history
Signed-off-by: saintube <saintube@foxmail.com>
  • Loading branch information
saintube authored and saintube committed Aug 29, 2024
1 parent 7f664ec commit 9c86c81
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion apis/extension/reservation.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const (
// reserved resources unallocated of all reservations on the node. If a pod scheduled with this label on a node,
// the reservations of the node will not consider the pod as their owners. To avoid the pods setting with this label
// to block the other pods allocated reserved resources, it should be used with the reservation preemption.
// It is similar to match all reservations with the default allocate policy.
LabelReservationIgnored = SchedulingDomainPrefix + "/reservation-ignored"

// LabelReservationOrder controls the preference logic for Reservation.
Expand Down
2 changes: 2 additions & 0 deletions apis/scheduling/v1alpha1/reservation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ type ReservationAllocatePolicy string
const (
// ReservationAllocatePolicyDefault means that there is no restriction on the policy of reserved resources,
// and allocated from the Reservation first, and if it is insufficient, it is allocated from the node.
// DEPRECATED: ReservationAllocatePolicyDefault is deprecated, it is considered as Aligned if specified.
// Please try other polices or set LabelReservationIgnored instead.
ReservationAllocatePolicyDefault ReservationAllocatePolicy = ""
// ReservationAllocatePolicyAligned indicates that the Pod allocates resources from the Reservation first.
// If the remaining resources of the Reservation are insufficient, it can be allocated from the node,
Expand Down
5 changes: 1 addition & 4 deletions pkg/scheduler/plugins/deviceshare/reservation.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,19 +278,16 @@ func (p *Plugin) tryAllocateIgnoreReservation(
requiredFromReservation bool,
) (apiext.DeviceAllocations, *framework.Status) {
preemptibleFromIgnored := map[schedulingv1alpha1.DeviceType]deviceResources{}
allocatableFromIgnored := map[schedulingv1alpha1.DeviceType]deviceResources{}

// accumulate all ignored reserved resources which are not allocated to any owner pods
for _, alloc := range ignoredReservations {
preemptibleFromIgnored = appendAllocated(preemptibleFromIgnored,
state.preemptibleInRRs[node.Name][alloc.rInfo.UID()], alloc.remained)
allocatableFromIgnored = appendAllocated(allocatableFromIgnored, alloc.allocatable)
}

preemptibleFromIgnored = appendAllocated(preemptibleFromIgnored, basicPreemptible, restoreState.mergedMatchedAllocated)
preferred := newDeviceMinorMap(allocatableFromIgnored)

return allocator.Allocate(nil, preferred, nil, preemptibleFromIgnored)
return allocator.Allocate(nil, nil, nil, preemptibleFromIgnored)
}

func (p *Plugin) makeReasonsByReservation(reservationReasons []*framework.Status) []string {
Expand Down

0 comments on commit 9c86c81

Please sign in to comment.