Skip to content

Commit

Permalink
RB suspension: API change
Browse files Browse the repository at this point in the history
Signed-off-by: Monokaix <[email protected]>
  • Loading branch information
Monokaix committed Jan 2, 2025
1 parent ba1e68d commit 3c1b729
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 4 deletions.
12 changes: 10 additions & 2 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -20417,7 +20417,11 @@
"items": {
"default": {},
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Condition"
}
},
"x-kubernetes-list-map-keys": [
"type"
],
"x-kubernetes-list-type": "map"
},
"lastScheduledTime": {
"description": "LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling. It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC.",
Expand All @@ -20435,7 +20439,7 @@
}
},
"com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.Suspension": {
"description": "Suspension defines the policy for suspending of propagation.",
"description": "Suspension defines the policy for suspending dispatching and scheduling.",
"type": "object",
"properties": {
"dispatching": {
Expand All @@ -20445,6 +20449,10 @@
"dispatchingOnClusters": {
"description": "DispatchingOnClusters declares a list of clusters to which the dispatching should be suspended. Note: Can not co-exist with Dispatching which is used to suspend all.",
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.SuspendClusters"
},
"scheduling": {
"description": "Scheduling controls whether scheduling should be suspended, the scheduler will pause scheduling and not process resource binding when the value is true and resume scheduling when it's false or nil. This is designed for third-party systems to temporarily pause the scheduling of applications, which enabling manage resource allocation, prioritize critical workloads, etc. It is expected that third-party systems use an admission webhook to suspend scheduling at the time of ResourceBinding creation. Once a ResourceBinding has been scheduled, it cannot be paused afterward, as it may lead to ineffective suspension.",
"type": "boolean"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,16 @@ spec:
type: string
type: array
type: object
scheduling:
description: |-
Scheduling controls whether scheduling should be suspended, the scheduler will pause scheduling and not
process resource binding when the value is true and resume scheduling when it's false or nil.
This is designed for third-party systems to temporarily pause the scheduling of applications, which enabling
manage resource allocation, prioritize critical workloads, etc.
It is expected that third-party systems use an admission webhook to suspend scheduling at the time of
ResourceBinding creation. Once a ResourceBinding has been scheduled, it cannot be paused afterward, as it may
lead to ineffective suspension.
type: boolean
type: object
required:
- resource
Expand Down Expand Up @@ -1384,6 +1394,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
lastScheduledTime:
description: |-
LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,16 @@ spec:
type: string
type: array
type: object
scheduling:
description: |-
Scheduling controls whether scheduling should be suspended, the scheduler will pause scheduling and not
process resource binding when the value is true and resume scheduling when it's false or nil.
This is designed for third-party systems to temporarily pause the scheduling of applications, which enabling
manage resource allocation, prioritize critical workloads, etc.
It is expected that third-party systems use an admission webhook to suspend scheduling at the time of
ResourceBinding creation. Once a ResourceBinding has been scheduled, it cannot be paused afterward, as it may
lead to ineffective suspension.
type: boolean
type: object
required:
- resource
Expand Down Expand Up @@ -1384,6 +1394,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
lastScheduledTime:
description: |-
LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling.
Expand Down
14 changes: 13 additions & 1 deletion pkg/apis/work/v1alpha2/binding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,19 @@ type BindingSnapshot struct {
Clusters []TargetCluster `json:"clusters,omitempty"`
}

// Suspension defines the policy for suspending of propagation.
// Suspension defines the policy for suspending dispatching and scheduling.
type Suspension struct {
policyv1alpha1.Suspension `json:",inline"`

// Scheduling controls whether scheduling should be suspended, the scheduler will pause scheduling and not
// process resource binding when the value is true and resume scheduling when it's false or nil.
// This is designed for third-party systems to temporarily pause the scheduling of applications, which enabling
// manage resource allocation, prioritize critical workloads, etc.
// It is expected that third-party systems use an admission webhook to suspend scheduling at the time of
// ResourceBinding creation. Once a ResourceBinding has been scheduled, it cannot be paused afterward, as it may
// lead to ineffective suspension.
// +optional
Scheduling *bool `json:"scheduling,omitempty"`
}

// ResourceBindingStatus represents the overall status of the strategy as well as the referenced resources.
Expand All @@ -347,6 +357,8 @@ type ResourceBindingStatus struct {

// Conditions contain the different condition statuses.
// +optional
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`

// AggregatedStatus represents status list of the resource running in each member cluster.
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/work/v1alpha2/zz_generated.deepcopy.go

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

17 changes: 16 additions & 1 deletion 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 3c1b729

Please sign in to comment.