Skip to content

Commit

Permalink
apis: add reservation name, taints and tolerations in ReservationAffi…
Browse files Browse the repository at this point in the history
…nitty (#2186)

Signed-off-by: 佑祎 <[email protected]>
  • Loading branch information
zwzhang0107 authored Sep 2, 2024
1 parent 7a1559b commit d9c40a5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apis/extension/reservation.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ type ReservationAllocated struct {

// ReservationAffinity represents the constraints of Pod selection Reservation
type ReservationAffinity struct {
// Specifies the reservation name directly, other reservation affinity fields will be ignored.
Name string `json:"name,omitempty"`
// If the affinity requirements specified by this field are not met at
// scheduling time, the pod will not be scheduled onto the node.
// If the affinity requirements specified by this field cease to be met
Expand All @@ -66,6 +68,8 @@ type ReservationAffinity struct {
// ReservationSelector is a selector which must be true for the pod to fit on a reservation.
// Selector which must match a reservation's labels for the pod to be scheduled on that node.
ReservationSelector map[string]string `json:"reservationSelector,omitempty"`
// Specifies the pod's reservation tolerations. This can tolerate taints of Reservation.
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
}

// ReservationAffinitySelector represents the union of the results of one or more label queries
Expand Down
4 changes: 4 additions & 0 deletions apis/scheduling/v1alpha1/reservation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ type ReservationSpec struct {
// Unschedulable controls reservation schedulability of new pods. By default, reservation is schedulable.
// +optional
Unschedulable bool `json:"unschedulable,omitempty"`
// Specifies the reservation's taints. This can be toleranted by the reservation tolerance.
// Eviction is not supported for NoExecute taints
// +optional
Taints []corev1.Taint `json:"taints,omitempty"`
}

type ReservationAllocatePolicy string
Expand Down
7 changes: 7 additions & 0 deletions apis/scheduling/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions config/crd/bases/scheduling.koordinator.sh_reservations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,38 @@ spec:
When `preAllocation` is set, the scheduler will skip this validation and allow overcommitment. The scheduled
reservation would be waiting to be available until free resources are sufficient.
type: boolean
taints:
description: |-
Specifies the reservation's taints. This can be toleranted by the reservation tolerance.
Eviction is not supported for NoExecute taints
items:
description: |-
The node this Taint is attached to has the "effect" on
any pod that does not tolerate the Taint.
properties:
effect:
description: |-
Required. The effect of the taint on pods
that do not tolerate the taint.
Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
type: string
key:
description: Required. The taint key to be applied to a node.
type: string
timeAdded:
description: |-
TimeAdded represents the time at which the taint was added.
It is only written for NoExecute taints.
format: date-time
type: string
value:
description: The taint value corresponding to the taint key.
type: string
required:
- effect
- key
type: object
type: array
template:
description: |-
Template defines the scheduling requirements (resources, affinities, images, ...) processed by the scheduler just
Expand Down

0 comments on commit d9c40a5

Please sign in to comment.