Skip to content

Commit

Permalink
Merge pull request #240 from JackZxj/chore/remove-deprecated
Browse files Browse the repository at this point in the history
chore(policy): remove deprecated parameters
  • Loading branch information
mrlihanbo authored Sep 25, 2023
2 parents 6187ed8 + 2fc88b3 commit e0dd3cd
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 52 deletions.
12 changes: 0 additions & 12 deletions config/crds/core.kubeadmiral.io_clusterpropagationpolicies.yaml

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

12 changes: 0 additions & 12 deletions config/crds/core.kubeadmiral.io_propagationpolicies.yaml

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

1 change: 0 additions & 1 deletion config/crds/patches/generic_propagationpolicies.src.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# controller-gen does not respect {} as default value for a struct field
# issue: https://github.com/kubernetes-sigs/controller-tools/issues/622
yq eval -i '.spec.versions[0].schema.openAPIV3Schema.properties.spec.properties.replicaRescheduling.default = {}' "$1"
yq eval -i '.spec.versions[0].schema.openAPIV3Schema.properties.spec.properties.reschedulePolicy.properties.replicaRescheduling.default = {}' "$1"

# policies are always referenced from labels, the value of which has limited length
Expand Down
11 changes: 0 additions & 11 deletions pkg/apis/core/v1alpha1/types_propagationpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ type PropagationPolicySpec struct {

// SchedulingMode determines the mode used for scheduling.
SchedulingMode SchedulingMode `json:"schedulingMode"`
// StickyCluster determines if a federated object can be rescheduled.
// +optional
// Deprecated: Please use reschedulePolicy.disableRescheduling instead. This field will be removed in the next release.
StickyCluster bool `json:"stickyCluster"`

// ClusterSelector is a label query over clusters to consider for scheduling.
// An empty or nil ClusterSelector selects everything.
Expand Down Expand Up @@ -103,13 +99,6 @@ type PropagationPolicySpec struct {
// +optional
AutoMigration *AutoMigration `json:"autoMigration,omitempty"`

// Configures behaviors related to replica rescheduling.
// +optional
// Default set via a post-generation patch.
// See patch file for details.
// Deprecated: Please use reschedulePolicy.disableRescheduling instead. This field will be removed in the next release.
ReplicaRescheduling *ReplicaRescheduling `json:"replicaRescheduling,omitempty"`

// Configures behaviors related to rescheduling.
// +optional
// +kubebuilder:default:={rescheduleWhen:{policyContentChanged:true}}
Expand Down
5 changes: 0 additions & 5 deletions pkg/apis/core/v1alpha1/zz_generated.deepcopy.go

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

15 changes: 4 additions & 11 deletions pkg/controllers/scheduler/schedulingunit.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,20 +241,13 @@ func getAutoMigrationInfo(fedObject fedcorev1a1.GenericFederatedObject) (*framew
}

func getIsStickyClusterFromPolicy(policy fedcorev1a1.GenericPropagationPolicy) bool {
// Currently, either switch can take effect
if rp := policy.GetSpec().ReschedulePolicy; rp != nil && rp.DisableRescheduling {
return true
}
return policy.GetSpec().StickyCluster
rp := policy.GetSpec().ReschedulePolicy
return rp != nil && rp.DisableRescheduling
}

func getAvoidDisruptionFromPolicy(policy fedcorev1a1.GenericPropagationPolicy) bool {
// Currently, either switch can take effect
if rp := policy.GetSpec().ReschedulePolicy; rp != nil &&
rp.ReplicaRescheduling != nil && rp.ReplicaRescheduling.AvoidDisruption {
return true
}
return policy.GetSpec().ReplicaRescheduling != nil && policy.GetSpec().ReplicaRescheduling.AvoidDisruption
rp := policy.GetSpec().ReschedulePolicy
return rp != nil && rp.ReplicaRescheduling != nil && rp.ReplicaRescheduling.AvoidDisruption
}

func getIsStickyClusterFromObject(object fedcorev1a1.GenericFederatedObject) (bool, bool) {
Expand Down

0 comments on commit e0dd3cd

Please sign in to comment.