Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cluster-level resource propagation pause and resume capabilities #4838

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -19118,6 +19118,10 @@
"schedulerName": {
"description": "SchedulerName represents which scheduler to proceed the scheduling. If specified, the policy will be dispatched by specified scheduler. If not specified, the policy will be dispatched by default scheduler.",
"type": "string"
},
"suspension": {
"description": "Suspension declares the policy for suspending different aspects of propagation. nil means no suspension. no default values.",
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.Suspension"
}
}
},
Expand Down Expand Up @@ -19256,6 +19260,34 @@
}
}
},
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.SuspendClusters": {
"description": "SuspendClusters represents a group of clusters that should be suspended from propagating. Note: No plan to introduce the label selector or field selector to select clusters yet, as it would make the system unpredictable.",
"type": "object",
"properties": {
"clusterNames": {
"description": "ClusterNames is the list of clusters to be selected.",
"type": "array",
"items": {
"type": "string",
"default": ""
}
}
}
},
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.Suspension": {
"description": "Suspension defines the policy for suspending different aspects of propagation.",
"type": "object",
"properties": {
"dispatching": {
"description": "Dispatching controls whether dispatching should be suspended. nil means not suspend, no default value, only accepts 'true'. Note: true means stop propagating to all clusters. Can not co-exist with DispatchingOnClusters which is used to suspend particular clusters.",
"type": "boolean"
},
"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"
}
}
},
"com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.ClusterAffinity": {
"description": "ClusterAffinity represents the filter to select clusters.",
"type": "object",
Expand Down Expand Up @@ -19720,6 +19752,10 @@
"description": "WorkSpec defines the desired state of Work.",
"type": "object",
"properties": {
"suspendDispatching": {
"description": "SuspendDispatching controls whether dispatching should be suspended, nil means not suspend. Note: true means stop propagating to all clusters.",
"type": "boolean"
},
"workload": {
"description": "Workload represents the manifest workload to be deployed on managed cluster.",
"default": {},
Expand Down Expand Up @@ -20171,6 +20207,10 @@
"schedulerName": {
"description": "SchedulerName represents which scheduler to proceed the scheduling. It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).",
"type": "string"
},
"suspension": {
"description": "Suspension declares the policy for suspending different aspects of propagation. nil means no suspension. no default values.",
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.Suspension"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,31 @@ spec:
If specified, the policy will be dispatched by specified scheduler.
If not specified, the policy will be dispatched by default scheduler.
type: string
suspension:
description: |-
Suspension declares the policy for suspending different aspects of propagation.
nil means no suspension. no default values.
properties:
dispatching:
description: |-
Dispatching controls whether dispatching should be suspended.
nil means not suspend, no default value, only accepts 'true'.
Note: true means stop propagating to all clusters. Can not co-exist
with DispatchingOnClusters which is used to suspend particular clusters.
type: boolean
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.
properties:
clusterNames:
description: ClusterNames is the list of clusters to be selected.
items:
type: string
type: array
type: object
type: object
required:
- resourceSelectors
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,31 @@ spec:
If specified, the policy will be dispatched by specified scheduler.
If not specified, the policy will be dispatched by default scheduler.
type: string
suspension:
description: |-
Suspension declares the policy for suspending different aspects of propagation.
nil means no suspension. no default values.
properties:
dispatching:
description: |-
Dispatching controls whether dispatching should be suspended.
nil means not suspend, no default value, only accepts 'true'.
Note: true means stop propagating to all clusters. Can not co-exist
with DispatchingOnClusters which is used to suspend particular clusters.
type: boolean
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.
properties:
clusterNames:
description: ClusterNames is the list of clusters to be selected.
items:
type: string
type: array
type: object
type: object
required:
- resourceSelectors
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,31 @@ spec:
SchedulerName represents which scheduler to proceed the scheduling.
It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).
type: string
suspension:
description: |-
Suspension declares the policy for suspending different aspects of propagation.
nil means no suspension. no default values.
properties:
dispatching:
description: |-
Dispatching controls whether dispatching should be suspended.
nil means not suspend, no default value, only accepts 'true'.
Note: true means stop propagating to all clusters. Can not co-exist
with DispatchingOnClusters which is used to suspend particular clusters.
type: boolean
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.
properties:
clusterNames:
description: ClusterNames is the list of clusters to be selected.
items:
type: string
type: array
type: object
type: object
required:
- resource
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,31 @@ spec:
SchedulerName represents which scheduler to proceed the scheduling.
It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).
type: string
suspension:
description: |-
Suspension declares the policy for suspending different aspects of propagation.
nil means no suspension. no default values.
properties:
dispatching:
description: |-
Dispatching controls whether dispatching should be suspended.
nil means not suspend, no default value, only accepts 'true'.
Note: true means stop propagating to all clusters. Can not co-exist
with DispatchingOnClusters which is used to suspend particular clusters.
type: boolean
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.
properties:
clusterNames:
description: ClusterNames is the list of clusters to be selected.
items:
type: string
type: array
type: object
type: object
required:
- resource
type: object
Expand Down
6 changes: 6 additions & 0 deletions charts/karmada/_crds/bases/work/work.karmada.io_works.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ spec:
spec:
description: Spec represents the desired behavior of Work.
properties:
suspendDispatching:
description: |-
SuspendDispatching controls whether dispatching should
be suspended, nil means not suspend.
Note: true means stop propagating to all clusters.
type: boolean
workload:
description: Workload represents the manifest workload to be deployed
on managed cluster.
Expand Down
30 changes: 30 additions & 0 deletions pkg/apis/policy/v1alpha1/propagation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ type PropagationSpec struct {
// +kubebuilder:validation:Enum=Lazy
// +optional
ActivationPreference ActivationPreference `json:"activationPreference,omitempty"`

// Suspension declares the policy for suspending different aspects of propagation.
// nil means no suspension. no default values.
// +optional
Suspension *Suspension `json:"suspension,omitempty"`
}

// ResourceSelector the resources will be selected.
Expand Down Expand Up @@ -210,6 +215,31 @@ type FieldSelector struct {
MatchExpressions []corev1.NodeSelectorRequirement `json:"matchExpressions,omitempty"`
}

// Suspension defines the policy for suspending different aspects of propagation.
type Suspension struct {
// Dispatching controls whether dispatching should be suspended.
// nil means not suspend, no default value, only accepts 'true'.
// Note: true means stop propagating to all clusters. Can not co-exist
// with DispatchingOnClusters which is used to suspend particular clusters.
// +optional
Dispatching *bool `json:"dispatching,omitempty"`

// 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.
// +optional
DispatchingOnClusters *SuspendClusters `json:"dispatchingOnClusters,omitempty"`
}

// SuspendClusters represents a group of clusters that should be suspended from propagating.
// Note: No plan to introduce the label selector or field selector to select clusters yet, as it
// would make the system unpredictable.
type SuspendClusters struct {
// ClusterNames is the list of clusters to be selected.
// +optional
ClusterNames []string `json:"clusterNames,omitempty"`
}

// PurgeMode represents that how to deal with the legacy applications on the
// cluster from which the application is migrated.
type PurgeMode string
Expand Down
52 changes: 52 additions & 0 deletions pkg/apis/policy/v1alpha1/zz_generated.deepcopy.go

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

6 changes: 6 additions & 0 deletions pkg/apis/work/v1alpha1/work_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ type Work struct {
type WorkSpec struct {
// Workload represents the manifest workload to be deployed on managed cluster.
Workload WorkloadTemplate `json:"workload,omitempty"`

// SuspendDispatching controls whether dispatching should
// be suspended, nil means not suspend.
// Note: true means stop propagating to all clusters.
// +optional
SuspendDispatching *bool `json:"suspendDispatching,omitempty"`
}

// WorkloadTemplate represents the manifest workload to be deployed on managed cluster.
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/work/v1alpha1/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions pkg/apis/work/v1alpha2/binding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ type ResourceBindingSpec struct {
// It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC.
// +optional
RescheduleTriggeredAt *metav1.Time `json:"rescheduleTriggeredAt,omitempty"`

// Suspension declares the policy for suspending different aspects of propagation.
// nil means no suspension. no default values.
// +optional
Suspension *policyv1alpha1.Suspension `json:"suspension,omitempty"`
}

// ObjectReference contains enough information to locate the referenced object inside current 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.

Loading