Add Priority and PreemptionPolicy fields in ResourceBinding

Signed-off-by: wei-chenglai <qazwsx0939059006@gmail.com>
This commit is contained in:
wei-chenglai 2024-12-18 21:41:09 -05:00
parent f555413215
commit bc6b04236a
6 changed files with 104 additions and 1 deletions

View File

@ -20389,6 +20389,10 @@
"default": {},
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.ObjectReference"
},
"schedulePriority": {
"description": "SchedulePriority represents the scheduling priority assigned to workloads.",
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.SchedulePriority"
},
"schedulerName": {
"description": "SchedulerName represents which scheduler to proceed the scheduling. It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).",
"type": "string"
@ -20434,6 +20438,17 @@
}
}
},
"com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.SchedulePriority": {
"description": "SchedulePriority represents the scheduling priority assigned to workloads.",
"type": "object",
"properties": {
"priority": {
"description": "Priority specifies the scheduling priority for the binding. Higher values indicate a higher priority. If not explicitly set, the default value is 0.",
"type": "integer",
"format": "int32"
}
}
},
"com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.Suspension": {
"description": "Suspension defines the policy for suspending dispatching and scheduling.",
"type": "object",

View File

@ -1252,6 +1252,19 @@ spec:
- kind
- name
type: object
schedulePriority:
description: SchedulePriority represents the scheduling priority assigned
to workloads.
properties:
priority:
default: 0
description: |-
Priority specifies the scheduling priority for the binding.
Higher values indicate a higher priority.
If not explicitly set, the default value is 0.
format: int32
type: integer
type: object
schedulerName:
description: |-
SchedulerName represents which scheduler to proceed the scheduling.

View File

@ -1252,6 +1252,19 @@ spec:
- kind
- name
type: object
schedulePriority:
description: SchedulePriority represents the scheduling priority assigned
to workloads.
properties:
priority:
default: 0
description: |-
Priority specifies the scheduling priority for the binding.
Higher values indicate a higher priority.
If not explicitly set, the default value is 0.
format: int32
type: integer
type: object
schedulerName:
description: |-
SchedulerName represents which scheduler to proceed the scheduling.

View File

@ -159,6 +159,10 @@ type ResourceBindingSpec struct {
// This setting applies to all Work objects created under this binding object.
// +optional
PreserveResourcesOnDeletion *bool `json:"preserveResourcesOnDeletion,omitempty"`
// SchedulePriority represents the scheduling priority assigned to workloads.
// +optional
SchedulePriority *SchedulePriority `json:"schedulePriority,omitempty"`
}
// ObjectReference contains enough information to locate the referenced object inside current cluster.
@ -337,6 +341,16 @@ type Suspension struct {
Scheduling *bool `json:"scheduling,omitempty"`
}
// SchedulePriority represents the scheduling priority assigned to workloads.
type SchedulePriority struct {
// Priority specifies the scheduling priority for the binding.
// Higher values indicate a higher priority.
// If not explicitly set, the default value is 0.
// +kubebuilder:default=0
// +optional
Priority int32 `json:"priority,omitempty"`
}
// ResourceBindingStatus represents the overall status of the strategy as well as the referenced resources.
type ResourceBindingStatus struct {
// SchedulerObservedGeneration is the generation(.metadata.generation) observed by the scheduler.

View File

@ -370,6 +370,11 @@ func (in *ResourceBindingSpec) DeepCopyInto(out *ResourceBindingSpec) {
*out = new(bool)
**out = **in
}
if in.SchedulePriority != nil {
in, out := &in.SchedulePriority, &out.SchedulePriority
*out = new(SchedulePriority)
**out = **in
}
return
}
@ -417,6 +422,22 @@ func (in *ResourceBindingStatus) DeepCopy() *ResourceBindingStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SchedulePriority) DeepCopyInto(out *SchedulePriority) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulePriority.
func (in *SchedulePriority) DeepCopy() *SchedulePriority {
if in == nil {
return nil
}
out := new(SchedulePriority)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Suspension) DeepCopyInto(out *Suspension) {
*out = *in

View File

@ -180,6 +180,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ResourceBindingList": schema_pkg_apis_work_v1alpha2_ResourceBindingList(ref),
"github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ResourceBindingSpec": schema_pkg_apis_work_v1alpha2_ResourceBindingSpec(ref),
"github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ResourceBindingStatus": schema_pkg_apis_work_v1alpha2_ResourceBindingStatus(ref),
"github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.SchedulePriority": schema_pkg_apis_work_v1alpha2_SchedulePriority(ref),
"github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.Suspension": schema_pkg_apis_work_v1alpha2_Suspension(ref),
"github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.TargetCluster": schema_pkg_apis_work_v1alpha2_TargetCluster(ref),
"github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.TaskOptions": schema_pkg_apis_work_v1alpha2_TaskOptions(ref),
@ -7385,12 +7386,18 @@ func schema_pkg_apis_work_v1alpha2_ResourceBindingSpec(ref common.ReferenceCallb
Format: "",
},
},
"schedulePriority": {
SchemaProps: spec.SchemaProps{
Description: "SchedulePriority represents the scheduling priority assigned to workloads.",
Ref: ref("github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.SchedulePriority"),
},
},
},
Required: []string{"resource"},
},
},
Dependencies: []string{
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FailoverBehavior", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.Placement", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.BindingSnapshot", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.GracefulEvictionTask", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ObjectReference", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ReplicaRequirements", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.Suspension", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.TargetCluster", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FailoverBehavior", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.Placement", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.BindingSnapshot", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.GracefulEvictionTask", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ObjectReference", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ReplicaRequirements", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.SchedulePriority", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.Suspension", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.TargetCluster", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
@ -7457,6 +7464,26 @@ func schema_pkg_apis_work_v1alpha2_ResourceBindingStatus(ref common.ReferenceCal
}
}
func schema_pkg_apis_work_v1alpha2_SchedulePriority(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "SchedulePriority represents the scheduling priority assigned to workloads.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"priority": {
SchemaProps: spec.SchemaProps{
Description: "Priority specifies the scheduling priority for the binding. Higher values indicate a higher priority. If not explicitly set, the default value is 0.",
Type: []string{"integer"},
Format: "int32",
},
},
},
},
},
}
}
func schema_pkg_apis_work_v1alpha2_Suspension(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{