Skip to content

Commit

Permalink
add priority api for subscription (#765)
Browse files Browse the repository at this point in the history
Signed-off-by: Mars <abstractmj@qq.com>
  • Loading branch information
abstractmj authored Nov 17, 2023
1 parent ca09a3a commit d46b99f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
25 changes: 25 additions & 0 deletions apps/v1alpha1/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ type SubscriptionSpec struct {
// +optional
DividingScheduling *DividingScheduling `json:"dividingScheduling,omitempty"`

// The priority value. clusternet-scheduler use this field to find the
// priority of the subscription.
// The higher the value, the higher the priority.
// +optional
Priority *int32 `json:"priority,omitempty"`

// PreemptionPolicy is the Policy for preempting subscriptions with lower priority.
// One of Never, PreemptLowerPriority.
// Defaults to PreemptLowerPriority if unset.
//
// +optional
// +kubebuilder:validation:Enum=PreemptLowerPriority;PreemptNever
// +kubebuilder:validation:Type=string
// +kubebuilder:default=PreemptLowerPriority
PreemptionPolicy *PreemptionPolicy `json:"preemptionPolicy,omitempty"`

// Subscribers subscribes
//
// +required
Expand Down Expand Up @@ -369,6 +385,15 @@ const (
BinpackDividingStrategy DynamicDividingStrategy = "Binpack"
)

type PreemptionPolicy string

const (
// PreemptLowerPriority means that subscription can preempt other subscriptions with lower priority.
PreemptLowerPriority PreemptionPolicy = "PreemptLowerPriority"
// PreemptNever means that subscription never preempts other subscriptions with lower priority.
PreemptNever PreemptionPolicy = "Never"
)

// +kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

Expand Down
10 changes: 10 additions & 0 deletions apps/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit d46b99f

Please sign in to comment.