Skip to content

Commit

Permalink
Add Priority and PreemptionPolicy fields in ResourceBinding
Browse files Browse the repository at this point in the history
Signed-off-by: wei-chenglai <[email protected]>
  • Loading branch information
seanlaii committed Dec 19, 2024
1 parent 8d89d77 commit 9ceb28b
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -20355,10 +20355,19 @@
"description": "Placement represents the rule for select clusters to propagate resources.",
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.Placement"
},
"preemptionPolicy": {
"description": "PreemptionPolicy controls the preemption policy of this binding. Valid values are: - Never: (default) prevents the binding from preempting other bindings - PreemptLowerPriority: allows the binding to preempt lower-priority bindings",
"type": "string"
},
"preserveResourcesOnDeletion": {
"description": "PreserveResourcesOnDeletion controls whether resources should be preserved on the member clusters when the binding object is deleted. If set to true, resources will be preserved on the member clusters. Default is false, which means resources will be deleted along with the binding object. This setting applies to all Work objects created under this binding object.",
"type": "boolean"
},
"priority": {
"description": "Priority represents the scheduling priority of the binding. Bindings with higher priority values are scheduled ahead of bindings with lower priority values. If not specified, the priority value is set to 0.",
"type": "integer",
"format": "int32"
},
"propagateDeps": {
"description": "PropagateDeps tells if relevant resources should be propagated automatically. It is inherited from PropagationPolicy or ClusterPropagationPolicy. default false.",
"type": "boolean"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,13 @@ spec:
type: object
type: array
type: object
preemptionPolicy:
description: |-
PreemptionPolicy controls the preemption policy of this binding.
Valid values are:
- Never: (default) prevents the binding from preempting other bindings
- PreemptLowerPriority: allows the binding to preempt lower-priority bindings
type: string
preserveResourcesOnDeletion:
description: |-
PreserveResourcesOnDeletion controls whether resources should be preserved on the
Expand All @@ -997,6 +1004,13 @@ spec:
Default is false, which means resources will be deleted along with the binding object.
This setting applies to all Work objects created under this binding object.
type: boolean
priority:
description: |-
Priority represents the scheduling priority of the binding.
Bindings with higher priority values are scheduled ahead of bindings with lower priority values.
If not specified, the priority value is set to 0.
format: int32
type: integer
propagateDeps:
description: |-
PropagateDeps tells if relevant resources should be propagated automatically.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,13 @@ spec:
type: object
type: array
type: object
preemptionPolicy:
description: |-
PreemptionPolicy controls the preemption policy of this binding.
Valid values are:
- Never: (default) prevents the binding from preempting other bindings
- PreemptLowerPriority: allows the binding to preempt lower-priority bindings
type: string
preserveResourcesOnDeletion:
description: |-
PreserveResourcesOnDeletion controls whether resources should be preserved on the
Expand All @@ -997,6 +1004,13 @@ spec:
Default is false, which means resources will be deleted along with the binding object.
This setting applies to all Work objects created under this binding object.
type: boolean
priority:
description: |-
Priority represents the scheduling priority of the binding.
Bindings with higher priority values are scheduled ahead of bindings with lower priority values.
If not specified, the priority value is set to 0.
format: int32
type: integer
propagateDeps:
description: |-
PropagateDeps tells if relevant resources should be propagated automatically.
Expand Down
23 changes: 23 additions & 0 deletions pkg/apis/work/v1alpha2/binding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ const (
ResourceNamespaceScopedClusterResourceBinding = false
)

// PreemptionPolicy defines the preemption policy for bindings
type PreemptionPolicy string

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

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
Expand Down Expand Up @@ -159,6 +169,19 @@ type ResourceBindingSpec struct {
// This setting applies to all Work objects created under this binding object.
// +optional
PreserveResourcesOnDeletion *bool `json:"preserveResourcesOnDeletion,omitempty"`

// Priority represents the scheduling priority of the binding.
// Bindings with higher priority values are scheduled ahead of bindings with lower priority values.
// If not specified, the priority value is set to 0.
// +optional
Priority int32 `json:"priority,omitempty"`

// PreemptionPolicy controls the preemption policy of this binding.
// Valid values are:
// - Never: (default) prevents the binding from preempting other bindings
// - PreemptLowerPriority: allows the binding to preempt lower-priority bindings
// +optional
PreemptionPolicy PreemptionPolicy `json:"preemptionPolicy,omitempty"`
}

// ObjectReference contains enough information to locate the referenced object inside current cluster.
Expand Down
14 changes: 14 additions & 0 deletions pkg/generated/openapi/zz_generated.openapi.go

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

0 comments on commit 9ceb28b

Please sign in to comment.