diff --git a/apps/v1alpha1/subscription.go b/apps/v1alpha1/subscription.go index d4ec274..5e8a883 100644 --- a/apps/v1alpha1/subscription.go +++ b/apps/v1alpha1/subscription.go @@ -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 @@ -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 diff --git a/apps/v1alpha1/zz_generated.deepcopy.go b/apps/v1alpha1/zz_generated.deepcopy.go index f33b41a..0987ecc 100644 --- a/apps/v1alpha1/zz_generated.deepcopy.go +++ b/apps/v1alpha1/zz_generated.deepcopy.go @@ -1202,6 +1202,16 @@ func (in *SubscriptionSpec) DeepCopyInto(out *SubscriptionSpec) { *out = new(DividingScheduling) (*in).DeepCopyInto(*out) } + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + if in.PreemptionPolicy != nil { + in, out := &in.PreemptionPolicy, &out.PreemptionPolicy + *out = new(PreemptionPolicy) + **out = **in + } if in.Subscribers != nil { in, out := &in.Subscribers, &out.Subscribers *out = make([]Subscriber, len(*in))