Merge pull request #5963 from seanlaii/priority-binding

Add Priority and PreemptionPolicy fields in ResourceBinding
This commit is contained in:
karmada-bot 2025-02-19 00:19:15 +08:00 committed by GitHub
commit a8ea49c4b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 104 additions and 1 deletions

View File

@ -20410,6 +20410,10 @@
"default": {}, "default": {},
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.ObjectReference" "$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": { "schedulerName": {
"description": "SchedulerName represents which scheduler to proceed the scheduling. It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).", "description": "SchedulerName represents which scheduler to proceed the scheduling. It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).",
"type": "string" "type": "string"
@ -20455,6 +20459,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": { "com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.Suspension": {
"description": "Suspension defines the policy for suspending dispatching and scheduling.", "description": "Suspension defines the policy for suspending dispatching and scheduling.",
"type": "object", "type": "object",

View File

@ -1252,6 +1252,19 @@ spec:
- kind - kind
- name - name
type: object 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: schedulerName:
description: |- description: |-
SchedulerName represents which scheduler to proceed the scheduling. SchedulerName represents which scheduler to proceed the scheduling.

View File

@ -1252,6 +1252,19 @@ spec:
- kind - kind
- name - name
type: object 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: schedulerName:
description: |- description: |-
SchedulerName represents which scheduler to proceed the scheduling. 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. // This setting applies to all Work objects created under this binding object.
// +optional // +optional
PreserveResourcesOnDeletion *bool `json:"preserveResourcesOnDeletion,omitempty"` 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. // ObjectReference contains enough information to locate the referenced object inside current cluster.
@ -337,6 +341,16 @@ type Suspension struct {
Scheduling *bool `json:"scheduling,omitempty"` 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. // ResourceBindingStatus represents the overall status of the strategy as well as the referenced resources.
type ResourceBindingStatus struct { type ResourceBindingStatus struct {
// SchedulerObservedGeneration is the generation(.metadata.generation) observed by the scheduler. // 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 = new(bool)
**out = **in **out = **in
} }
if in.SchedulePriority != nil {
in, out := &in.SchedulePriority, &out.SchedulePriority
*out = new(SchedulePriority)
**out = **in
}
return return
} }
@ -417,6 +422,22 @@ func (in *ResourceBindingStatus) DeepCopy() *ResourceBindingStatus {
return out 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. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Suspension) DeepCopyInto(out *Suspension) { func (in *Suspension) DeepCopyInto(out *Suspension) {
*out = *in *out = *in

View File

@ -181,6 +181,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.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.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.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.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.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), "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.TaskOptions": schema_pkg_apis_work_v1alpha2_TaskOptions(ref),
@ -7420,12 +7421,18 @@ func schema_pkg_apis_work_v1alpha2_ResourceBindingSpec(ref common.ReferenceCallb
Format: "", 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"}, Required: []string{"resource"},
}, },
}, },
Dependencies: []string{ 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"},
} }
} }
@ -7492,6 +7499,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 { func schema_pkg_apis_work_v1alpha2_Suspension(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{ return common.OpenAPIDefinition{
Schema: spec.Schema{ Schema: spec.Schema{