diff --git a/PROJECT b/PROJECT index 8d4b8efd4..f5e5885da 100644 --- a/PROJECT +++ b/PROJECT @@ -103,18 +103,6 @@ resources: defaulting: true validation: true webhookVersion: v1 -- api: - crdVersion: v1 - namespaced: true - controller: true - domain: emqx.io - group: apps - kind: Rebalance - path: github.com/emqx/emqx-operator/apis/apps/v1beta4 - version: v1beta4 - webhooks: - validation: true - webhookVersion: v1 - api: crdVersion: v1 namespaced: true @@ -139,8 +127,8 @@ resources: path: github.com/emqx/emqx-operator/apis/apps/v2alpha2 version: v2alpha2 webhooks: - conversion: true - defaulting: true + conversion: false + defaulting: false validation: true webhookVersion: v1 version: "3" diff --git a/apis/apps/v1beta4/rebalance_conversion.go b/apis/apps/v1beta4/rebalance_conversion.go deleted file mode 100644 index bcbb7250d..000000000 --- a/apis/apps/v1beta4/rebalance_conversion.go +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 2021. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta4 - -import ( - "encoding/json" - - "github.com/emqx/emqx-operator/apis/apps/v2alpha2" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this version to the Hub version (v1). -func (src *Rebalance) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*v2alpha2.Rebalance) - - b, err := json.Marshal(src) - if err != nil { - return err - } - - if err := json.Unmarshal(b, dst); err != nil { - return err - } - - dst.Spec.InstanceKind = "EMQX" - - // +kubebuilder:docs-gen:collapse=rote conversion - return nil -} - -// ConvertFrom converts from the Hub version (v1) to this version. -func (dst *Rebalance) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*v2alpha2.Rebalance) - - b, err := json.Marshal(src) - if err != nil { - return err - } - - if err := json.Unmarshal(b, dst); err != nil { - return err - } - - // +kubebuilder:docs-gen:collapse=rote conversion - return nil -} diff --git a/apis/apps/v1beta4/rebalance_conversion_test.go b/apis/apps/v1beta4/rebalance_conversion_test.go deleted file mode 100644 index 0e99d9eb9..000000000 --- a/apis/apps/v1beta4/rebalance_conversion_test.go +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright 2021. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta4 - -import ( - "testing" - - "github.com/emqx/emqx-operator/apis/apps/v2alpha2" - "github.com/stretchr/testify/assert" -) - -func TestConvertTo(t *testing.T) { - dst := &v2alpha2.Rebalance{} - src := &Rebalance{} - - assert.Nil(t, src.ConvertTo(dst)) -} - -func TestConvertFrom(t *testing.T) { - dst := &Rebalance{} - src := &v2alpha2.Rebalance{} - - assert.Nil(t, dst.ConvertFrom(src)) -} diff --git a/apis/apps/v1beta4/rebalance_types.go b/apis/apps/v1beta4/rebalance_types.go deleted file mode 100644 index 9547e8fd1..000000000 --- a/apis/apps/v1beta4/rebalance_types.go +++ /dev/null @@ -1,255 +0,0 @@ -/* -Copyright 2021. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta4 - -import ( - "fmt" - "sort" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// RebalanceSpec represents the desired spec of Rebalance -type RebalanceSpec struct { - // InstanceName represents the name of EmqxEnterprise CR - // +kubebuilder:validation:Required - InstanceName string `json:"instanceName"` - // RebalanceStrategy represents the strategy of EMQX rebalancing - // More info: https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing - // +kubebuilder:validation:Required - RebalanceStrategy RebalanceStrategy `json:"rebalanceStrategy"` -} - -// RebalanceStrategy represents the strategy of EMQX rebalancing -type RebalanceStrategy struct { - // ConnEvictRate represents the source node client disconnect rate per second. - // same to conn-evict-rate in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) - // The value must be greater than 0 - // +kubebuilder:validation:Required - // +kubebuilder:validation:Minimum=1 - ConnEvictRate int32 `json:"connEvictRate"` - // SessEvictRate represents the source node session evacuation rate per second. - // same to sess-evict-rate in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) - // The value must be greater than 0 - // Defaults to 500. - // +kubebuilder:default:=500 - SessEvictRate int32 `json:"sessEvictRate,omitempty"` - // WaitTakeover represents the time in seconds to wait for a client to - // reconnect to take over the session after all connections are disconnected. - // same to wait-takeover in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) - // The value must be greater than 0 - // Defaults to 60 seconds. - // +kubebuilder:default:=60 - WaitTakeover int32 `json:"waitTakeover,omitempty"` - // WaitHealthCheck represents the time (in seconds) to wait for the LB to - // remove the source node from the list of active backend nodes. After the - // specified waiting time is exceeded,the rebalancing task will start. - // same to wait-health-check in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) - // The value must be greater than 0 - // Defaults to 60 seconds. - // +kubebuilder:default:=60 - WaitHealthCheck int32 `json:"waitHealthCheck,omitempty"` - // AbsConnThreshold represents the absolute threshold for checking connection balance. - // same to abs-conn-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) - // The value must be greater than 0 - // Defaults to 1000. - // +kubebuilder:default:=1000 - AbsConnThreshold int32 `json:"absConnThreshold,omitempty"` - // RelConnThreshold represents the relative threshold for checkin connection balance. - // same to rel-conn-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) - // the usage of float highly discouraged, as support for them varies across languages. - // So we define the RelConnThreshold field as string type and you not float type - // The value must be greater than "1.0" - // Defaults to "1.1". - // +kubebuilder:default:="1.1" - RelConnThreshold string `json:"relConnThreshold,omitempty"` - // AbsSessThreshold represents the absolute threshold for checking session connection balance. - // same to abs-sess-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) - // The value must be greater than 0 - // Default to 1000. - // +kubebuilder:default:=1000 - AbsSessThreshold int32 `json:"absSessThreshold,omitempty"` - // RelSessThreshold represents the relative threshold for checking session connection balance. - // same to rel-sess-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) - // the usage of float highly discouraged, as support for them varies across languages. - // So we define the RelSessThreshold field as string type and you not float type - // The value must be greater than "1.0" - // Defaults to "1.1". - // +kubebuilder:default:="1.1" - RelSessThreshold string `json:"relSessThreshold,omitempty"` -} - -// RebalanceStatus represents the current state of Rebalance -type RebalanceStatus struct { - // The latest available observations of an object's current state. - // When Rebalance fails, the condition will have type "Failed" and status false. - // When Rebalance is in processing, the condition will have a type "Processing" and status true. - // When Rebalance is completed, the condition will have a type "Complete" and status true. - Conditions []RebalanceCondition `json:"conditions,omitempty"` - // Phase represents the phase of Rebalance. - Phase RebalancePhase `json:"phase,omitempty"` - RebalanceStates []RebalanceState `json:"rebalanceStates,omitempty"` - // StartedTime Represents the time when rebalance job start. - StartedTime metav1.Time `json:"startedTime,omitempty"` - // CompletedTime Represents the time when the rebalance job was completed. - CompletedTime metav1.Time `json:"completedTime,omitempty"` -} - -// Rebalance defines the observed Rebalancing state of EMQX -type RebalanceState struct { - // State represents the state of emqx cluster rebalancing. - State string `json:"state,omitempty"` - // SessionEvictionRate represents the node session evacuation rate per second. - SessionEvictionRate int32 `json:"session_eviction_rate,omitempty"` - // Recipients represent the target node for rebalancing. - Recipients []string `json:"recipients,omitempty"` - // Node represents the rebalancing scheduling node. - Node string `json:"node,omitempty"` - // Donors represent the source nodes for rebalancing. - Donors []string `json:"donors,omitempty"` - // CoordinatorNode represents the node currently undergoing rebalancing. - CoordinatorNode string `json:"coordinator_node,omitempty"` - // ConnectionEvictionRate represents the node session evacuation rate per second. - ConnectionEvictionRate int32 `json:"connection_eviction_rate,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status -// +kubebuilder:deprecatedversion -// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase" -// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" -// Rebalance is the Schema for the rebalances API -type Rebalance struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec RebalanceSpec `json:"spec,omitempty"` - Status RebalanceStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// RebalanceList contains a list of Rebalance -type RebalanceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Rebalance `json:"items"` -} - -// RebalanceCondition describes current state of a EMQX rebalancing job. -type RebalanceCondition struct { - // Status of rebalance condition type. one of Processing, Complete, Failed. - Type RebalanceConditionType `json:"type"` - // Status of the condition, one of True, False, Unknown. - Status corev1.ConditionStatus `json:"status"` - // The last time this condition was updated. - LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` - // Last time the condition transitioned from one status to another. - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` - // The reason for the condition's last transition. - Reason string `json:"reason,omitempty"` - // A human readable message indicating details about the transition. - Message string `json:"message,omitempty"` -} - -func (s *RebalanceStatus) SetFailed(condition RebalanceCondition) error { - if condition.Type != RebalanceConditionFailed { - return fmt.Errorf("condition type must be %s", RebalanceConditionFailed) - } - s.Phase = RebalancePhaseFailed - s.SetCondition(condition) - return nil -} - -func (s *RebalanceStatus) SetCompleted(condition RebalanceCondition) error { - if s.Phase != RebalancePhaseProcessing { - return fmt.Errorf("rebalance job is not in processing") - } - if condition.Type != RebalanceConditionCompleted { - return fmt.Errorf("condition type must be %s", RebalanceConditionCompleted) - } - s.Phase = RebalancePhaseCompleted - s.CompletedTime = metav1.Now() - s.SetCondition(condition) - return nil -} - -func (s *RebalanceStatus) SetProcessing(condition RebalanceCondition) error { - if s.Phase == RebalancePhaseFailed { - return fmt.Errorf("rebalance job has been failed") - } - if s.Phase == RebalancePhaseCompleted { - return fmt.Errorf("rebalance job has been completed") - } - if condition.Type != RebalanceConditionProcessing { - return fmt.Errorf("condition type must be %s", RebalanceConditionProcessing) - } - s.Phase = RebalancePhaseProcessing - if s.StartedTime.IsZero() { - s.StartedTime = metav1.Now() - } - s.SetCondition(condition) - return nil -} - -func (s *RebalanceStatus) SetCondition(condition RebalanceCondition) { - condition.LastUpdateTime = metav1.Now() - condition.LastTransitionTime = metav1.Now() - pos := getConditionIndex(s, condition.Type) - if pos >= 0 { - if s.Conditions[pos].Status == condition.Status { - condition.LastTransitionTime = s.Conditions[pos].LastTransitionTime - } - s.Conditions[pos] = condition - } else { - s.Conditions = append(s.Conditions, condition) - } - sort.Slice(s.Conditions, func(i, j int) bool { - return s.Conditions[j].LastUpdateTime.Before(&s.Conditions[i].LastUpdateTime) - }) -} - -func getConditionIndex(status *RebalanceStatus, condType RebalanceConditionType) int { - for i, c := range status.Conditions { - if condType == c.Type { - return i - } - } - return -1 -} - -type RebalancePhase string - -const ( - RebalancePhaseProcessing RebalancePhase = "Processing" - RebalancePhaseCompleted RebalancePhase = "Completed" - RebalancePhaseFailed RebalancePhase = "Failed" -) - -type RebalanceConditionType string - -// These are built-in conditions of a EMQX rebalancing job. -const ( - RebalanceConditionProcessing RebalanceConditionType = "Processing" - RebalanceConditionCompleted RebalanceConditionType = "Completed" - RebalanceConditionFailed RebalanceConditionType = "Failed" -) - -func init() { - SchemeBuilder.Register(&Rebalance{}, &RebalanceList{}) -} diff --git a/apis/apps/v1beta4/zz_generated.deepcopy.go b/apis/apps/v1beta4/zz_generated.deepcopy.go index b3fecf9a5..7929e0f5a 100644 --- a/apis/apps/v1beta4/zz_generated.deepcopy.go +++ b/apis/apps/v1beta4/zz_generated.deepcopy.go @@ -756,169 +756,6 @@ func (in *EvacuationStrategy) DeepCopy() *EvacuationStrategy { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Rebalance) DeepCopyInto(out *Rebalance) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rebalance. -func (in *Rebalance) DeepCopy() *Rebalance { - if in == nil { - return nil - } - out := new(Rebalance) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Rebalance) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RebalanceCondition) DeepCopyInto(out *RebalanceCondition) { - *out = *in - in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RebalanceCondition. -func (in *RebalanceCondition) DeepCopy() *RebalanceCondition { - if in == nil { - return nil - } - out := new(RebalanceCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RebalanceList) DeepCopyInto(out *RebalanceList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Rebalance, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RebalanceList. -func (in *RebalanceList) DeepCopy() *RebalanceList { - if in == nil { - return nil - } - out := new(RebalanceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RebalanceList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RebalanceSpec) DeepCopyInto(out *RebalanceSpec) { - *out = *in - out.RebalanceStrategy = in.RebalanceStrategy -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RebalanceSpec. -func (in *RebalanceSpec) DeepCopy() *RebalanceSpec { - if in == nil { - return nil - } - out := new(RebalanceSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RebalanceState) DeepCopyInto(out *RebalanceState) { - *out = *in - if in.Recipients != nil { - in, out := &in.Recipients, &out.Recipients - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Donors != nil { - in, out := &in.Donors, &out.Donors - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RebalanceState. -func (in *RebalanceState) DeepCopy() *RebalanceState { - if in == nil { - return nil - } - out := new(RebalanceState) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RebalanceStatus) DeepCopyInto(out *RebalanceStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]RebalanceCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.RebalanceStates != nil { - in, out := &in.RebalanceStates, &out.RebalanceStates - *out = make([]RebalanceState, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.StartedTime.DeepCopyInto(&out.StartedTime) - in.CompletedTime.DeepCopyInto(&out.CompletedTime) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RebalanceStatus. -func (in *RebalanceStatus) DeepCopy() *RebalanceStatus { - if in == nil { - return nil - } - out := new(RebalanceStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RebalanceStrategy) DeepCopyInto(out *RebalanceStrategy) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RebalanceStrategy. -func (in *RebalanceStrategy) DeepCopy() *RebalanceStrategy { - if in == nil { - return nil - } - out := new(RebalanceStrategy) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServiceTemplate) DeepCopyInto(out *ServiceTemplate) { *out = *in diff --git a/apis/apps/v2alpha2/rebalance_conversion.go b/apis/apps/v2alpha2/rebalance_conversion.go deleted file mode 100644 index ce089a512..000000000 --- a/apis/apps/v2alpha2/rebalance_conversion.go +++ /dev/null @@ -1,16 +0,0 @@ -/* -Copyright 2021. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha2 - -func (*Rebalance) Hub() {} diff --git a/config/crd/bases/apps.emqx.io_rebalances.yaml b/config/crd/bases/apps.emqx.io_rebalances.yaml index 63b524f63..1a53e5d92 100644 --- a/config/crd/bases/apps.emqx.io_rebalances.yaml +++ b/config/crd/bases/apps.emqx.io_rebalances.yaml @@ -15,130 +15,6 @@ spec: singular: rebalance scope: Namespaced versions: - - additionalPrinterColumns: - - jsonPath: .status.phase - name: Status - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - deprecated: true - name: v1beta4 - schema: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - instanceName: - type: string - rebalanceStrategy: - properties: - absConnThreshold: - default: 1000 - format: int32 - type: integer - absSessThreshold: - default: 1000 - format: int32 - type: integer - connEvictRate: - format: int32 - minimum: 1 - type: integer - relConnThreshold: - default: "1.1" - type: string - relSessThreshold: - default: "1.1" - type: string - sessEvictRate: - default: 500 - format: int32 - type: integer - waitHealthCheck: - default: 60 - format: int32 - type: integer - waitTakeover: - default: 60 - format: int32 - type: integer - required: - - connEvictRate - type: object - required: - - instanceName - - rebalanceStrategy - type: object - status: - properties: - completedTime: - format: date-time - type: string - conditions: - items: - properties: - lastTransitionTime: - format: date-time - type: string - lastUpdateTime: - format: date-time - type: string - message: - type: string - reason: - type: string - status: - type: string - type: - type: string - required: - - status - - type - type: object - type: array - phase: - type: string - rebalanceStates: - items: - properties: - connection_eviction_rate: - format: int32 - type: integer - coordinator_node: - type: string - donors: - items: - type: string - type: array - node: - type: string - recipients: - items: - type: string - type: array - session_eviction_rate: - format: int32 - type: integer - state: - type: string - type: object - type: array - startedTime: - format: date-time - type: string - type: object - type: object - served: true - storage: false - subresources: - status: {} - additionalPrinterColumns: - jsonPath: .status.phase name: Status diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 058bcf9f8..e2824f243 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -16,7 +16,7 @@ patchesStrategicMerge: - patches/webhook_in_emqxenterprises.yaml - patches/webhook_in_emqxplugins.yaml - patches/webhook_in_emqxes.yaml -- patches/webhook_in_rebalances.yaml +# - patches/webhook_in_rebalances.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. @@ -25,7 +25,7 @@ patchesStrategicMerge: - patches/cainjection_in_emqxenterprises.yaml - patches/cainjection_in_emqxplugins.yaml - patches/cainjection_in_emqxes.yaml -- patches/cainjection_in_rebalances.yaml +# - patches/cainjection_in_rebalances.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index 3c87433f2..92e74ec90 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -12,19 +12,19 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-apps-emqx-io-v2alpha2-emqx + path: /mutate-apps-emqx-io-v1beta4-emqxbroker failurePolicy: Fail - name: mutating.apps.emqx.io + name: mutating.broker.emqx.io rules: - apiGroups: - apps.emqx.io apiVersions: - - v2alpha2 + - v1beta4 operations: - CREATE - UPDATE resources: - - emqxes + - emqxbrokers sideEffects: None - admissionReviewVersions: - v1 @@ -33,9 +33,9 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-apps-emqx-io-v1beta4-emqxbroker + path: /mutate-apps-emqx-io-v1beta4-emqxenterprise failurePolicy: Fail - name: mutating.broker.emqx.io + name: mutating.enterprise.emqx.io rules: - apiGroups: - apps.emqx.io @@ -45,7 +45,7 @@ webhooks: - CREATE - UPDATE resources: - - emqxbrokers + - emqxenterprises sideEffects: None - admissionReviewVersions: - v1 @@ -54,9 +54,9 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-apps-emqx-io-v1beta4-emqxenterprise + path: /mutate-apps-emqx-io-v1beta4-emqxplugin failurePolicy: Fail - name: mutating.enterprise.emqx.io + name: mutating.emqxplugin.emqx.io rules: - apiGroups: - apps.emqx.io @@ -66,7 +66,7 @@ webhooks: - CREATE - UPDATE resources: - - emqxenterprises + - emqxplugins sideEffects: None - admissionReviewVersions: - v1 @@ -75,19 +75,19 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-apps-emqx-io-v1beta4-emqxplugin + path: /mutate-apps-emqx-io-v2alpha2-emqx failurePolicy: Fail - name: mutating.emqxplugin.emqx.io + name: mutating.apps.emqx.io rules: - apiGroups: - apps.emqx.io apiVersions: - - v1beta4 + - v2alpha2 operations: - CREATE - UPDATE resources: - - emqxplugins + - emqxes sideEffects: None --- apiVersion: admissionregistration.k8s.io/v1 @@ -103,19 +103,19 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-apps-emqx-io-v2alpha2-emqx + path: /validate-apps-emqx-io-v1beta4-emqxbroker failurePolicy: Fail - name: validator.apps.emqx.io + name: validator.broker.emqx.io rules: - apiGroups: - apps.emqx.io apiVersions: - - v2alpha2 + - v1beta4 operations: - CREATE - UPDATE resources: - - emqxes + - emqxbrokers sideEffects: None - admissionReviewVersions: - v1 @@ -124,19 +124,19 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-apps-emqx-io-v2alpha2-rebalance + path: /validate-apps-emqx-io-v1beta4-emqxenterprise failurePolicy: Fail - name: validator.rebalance.emqx.io + name: validator.enterprise.emqx.io rules: - apiGroups: - apps.emqx.io apiVersions: - - v2alpha2 + - v1beta4 operations: - CREATE - UPDATE resources: - - rebalances + - emqxenterprises sideEffects: None - admissionReviewVersions: - v1 @@ -145,9 +145,9 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-apps-emqx-io-v1beta4-emqxbroker + path: /validate-apps-emqx-io-v1beta4-emqxplugin failurePolicy: Fail - name: validator.broker.emqx.io + name: validator.emqxplugin.emqx.io rules: - apiGroups: - apps.emqx.io @@ -157,7 +157,7 @@ webhooks: - CREATE - UPDATE resources: - - emqxbrokers + - emqxplugins sideEffects: None - admissionReviewVersions: - v1 @@ -166,19 +166,19 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-apps-emqx-io-v1beta4-emqxenterprise + path: /validate-apps-emqx-io-v2alpha2-emqx failurePolicy: Fail - name: validator.enterprise.emqx.io + name: validator.apps.emqx.io rules: - apiGroups: - apps.emqx.io apiVersions: - - v1beta4 + - v2alpha2 operations: - CREATE - UPDATE resources: - - emqxenterprises + - emqxes sideEffects: None - admissionReviewVersions: - v1 @@ -187,17 +187,17 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-apps-emqx-io-v1beta4-emqxplugin + path: /validate-apps-emqx-io-v2alpha2-rebalance failurePolicy: Fail - name: validator.emqxplugin.emqx.io + name: validator.rebalance.emqx.io rules: - apiGroups: - apps.emqx.io apiVersions: - - v1beta4 + - v2alpha2 operations: - CREATE - UPDATE resources: - - emqxplugins + - rebalances sideEffects: None diff --git a/deploy/charts/emqx-operator/templates/crd.rebalances.apps.emqx.io.yaml b/deploy/charts/emqx-operator/templates/crd.rebalances.apps.emqx.io.yaml index cc97d60a4..56973e4ef 100644 --- a/deploy/charts/emqx-operator/templates/crd.rebalances.apps.emqx.io.yaml +++ b/deploy/charts/emqx-operator/templates/crd.rebalances.apps.emqx.io.yaml @@ -5,20 +5,10 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/{{ include "emqx-operator.fullname" . }}-serving-cert' controller-gen.kubebuilder.io/version: v0.9.2 + creationTimestamp: null name: rebalances.apps.emqx.io spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - name: '{{ include "emqx-operator.fullname" . }}-webhook-service' - namespace: '{{ .Release.Namespace }}' - path: /convert - conversionReviewVersions: - - v1 group: apps.emqx.io names: kind: Rebalance @@ -27,130 +17,6 @@ spec: singular: rebalance scope: Namespaced versions: - - additionalPrinterColumns: - - jsonPath: .status.phase - name: Status - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - deprecated: true - name: v1beta4 - schema: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - instanceName: - type: string - rebalanceStrategy: - properties: - absConnThreshold: - default: 1000 - format: int32 - type: integer - absSessThreshold: - default: 1000 - format: int32 - type: integer - connEvictRate: - format: int32 - minimum: 1 - type: integer - relConnThreshold: - default: "1.1" - type: string - relSessThreshold: - default: "1.1" - type: string - sessEvictRate: - default: 500 - format: int32 - type: integer - waitHealthCheck: - default: 60 - format: int32 - type: integer - waitTakeover: - default: 60 - format: int32 - type: integer - required: - - connEvictRate - type: object - required: - - instanceName - - rebalanceStrategy - type: object - status: - properties: - completedTime: - format: date-time - type: string - conditions: - items: - properties: - lastTransitionTime: - format: date-time - type: string - lastUpdateTime: - format: date-time - type: string - message: - type: string - reason: - type: string - status: - type: string - type: - type: string - required: - - status - - type - type: object - type: array - phase: - type: string - rebalanceStates: - items: - properties: - connection_eviction_rate: - format: int32 - type: integer - coordinator_node: - type: string - donors: - items: - type: string - type: array - node: - type: string - recipients: - items: - type: string - type: array - session_eviction_rate: - format: int32 - type: integer - state: - type: string - type: object - type: array - startedTime: - format: date-time - type: string - type: object - type: object - served: true - storage: false - subresources: - status: {} - additionalPrinterColumns: - jsonPath: .status.phase name: Status diff --git a/docs/en_US/reference/v1beta4-reference.md b/docs/en_US/reference/v1beta4-reference.md index e11861f57..e25ba6d65 100644 --- a/docs/en_US/reference/v1beta4-reference.md +++ b/docs/en_US/reference/v1beta4-reference.md @@ -12,8 +12,6 @@ Package v1beta4 contains API Schema definitions for the apps v1beta4 API group - [EmqxBroker](#emqxbroker) - [EmqxEnterprise](#emqxenterprise) - [EmqxPlugin](#emqxplugin) -- [Rebalance](#rebalance) -- [RebalanceList](#rebalancelist) @@ -432,155 +430,6 @@ _Appears in:_ -#### Rebalance - - - -Rebalance is the Schema for the rebalances API - -_Appears in:_ -- [RebalanceList](#rebalancelist) - -| Field | Description | -| --- | --- | -| `apiVersion` _string_ | `apps.emqx.io/v1beta4` -| `kind` _string_ | `Rebalance` -| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | -| `spec` _[RebalanceSpec](#rebalancespec)_ | | -| `status` _[RebalanceStatus](#rebalancestatus)_ | | - - -#### RebalanceCondition - - - -RebalanceCondition describes current state of a EMQX rebalancing job. - -_Appears in:_ -- [RebalanceStatus](#rebalancestatus) - -| Field | Description | -| --- | --- | -| `type` _[RebalanceConditionType](#rebalanceconditiontype)_ | Status of rebalance condition type. one of Processing, Complete, Failed. | -| `status` _[ConditionStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#conditionstatus-v1-core)_ | Status of the condition, one of True, False, Unknown. | -| `lastUpdateTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#time-v1-meta)_ | The last time this condition was updated. | -| `lastTransitionTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#time-v1-meta)_ | Last time the condition transitioned from one status to another. | -| `reason` _string_ | The reason for the condition's last transition. | -| `message` _string_ | A human readable message indicating details about the transition. | - - -#### RebalanceConditionType - -_Underlying type:_ `string` - - - -_Appears in:_ -- [RebalanceCondition](#rebalancecondition) - - - -#### RebalanceList - - - -RebalanceList contains a list of Rebalance - - - -| Field | Description | -| --- | --- | -| `apiVersion` _string_ | `apps.emqx.io/v1beta4` -| `kind` _string_ | `RebalanceList` -| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | -| `items` _[Rebalance](#rebalance) array_ | | - - -#### RebalancePhase - -_Underlying type:_ `string` - - - -_Appears in:_ -- [RebalanceStatus](#rebalancestatus) - - - -#### RebalanceSpec - - - -RebalanceSpec represents the desired spec of Rebalance - -_Appears in:_ -- [Rebalance](#rebalance) - -| Field | Description | -| --- | --- | -| `instanceName` _string_ | InstanceName represents the name of EmqxEnterprise CR | -| `rebalanceStrategy` _[RebalanceStrategy](#rebalancestrategy)_ | RebalanceStrategy represents the strategy of EMQX rebalancing More info: https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing | - - -#### RebalanceState - - - -Rebalance defines the observed Rebalancing state of EMQX - -_Appears in:_ -- [RebalanceStatus](#rebalancestatus) - -| Field | Description | -| --- | --- | -| `state` _string_ | State represents the state of emqx cluster rebalancing. | -| `session_eviction_rate` _integer_ | SessionEvictionRate represents the node session evacuation rate per second. | -| `recipients` _string array_ | Recipients represent the target node for rebalancing. | -| `node` _string_ | Node represents the rebalancing scheduling node. | -| `donors` _string array_ | Donors represent the source nodes for rebalancing. | -| `coordinator_node` _string_ | CoordinatorNode represents the node currently undergoing rebalancing. | -| `connection_eviction_rate` _integer_ | ConnectionEvictionRate represents the node session evacuation rate per second. | - - -#### RebalanceStatus - - - -RebalanceStatus represents the current state of Rebalance - -_Appears in:_ -- [Rebalance](#rebalance) - -| Field | Description | -| --- | --- | -| `conditions` _[RebalanceCondition](#rebalancecondition) array_ | The latest available observations of an object's current state. When Rebalance fails, the condition will have type "Failed" and status false. When Rebalance is in processing, the condition will have a type "Processing" and status true. When Rebalance is completed, the condition will have a type "Complete" and status true. | -| `phase` _[RebalancePhase](#rebalancephase)_ | Phase represents the phase of Rebalance. | -| `rebalanceStates` _[RebalanceState](#rebalancestate) array_ | | -| `startedTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#time-v1-meta)_ | StartedTime Represents the time when rebalance job start. | -| `completedTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#time-v1-meta)_ | CompletedTime Represents the time when the rebalance job was completed. | - - -#### RebalanceStrategy - - - -RebalanceStrategy represents the strategy of EMQX rebalancing - -_Appears in:_ -- [RebalanceSpec](#rebalancespec) - -| Field | Description | -| --- | --- | -| `connEvictRate` _integer_ | ConnEvictRate represents the source node client disconnect rate per second. same to conn-evict-rate in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 | -| `sessEvictRate` _integer_ | SessEvictRate represents the source node session evacuation rate per second. same to sess-evict-rate in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 Defaults to 500. | -| `waitTakeover` _integer_ | WaitTakeover represents the time in seconds to wait for a client to reconnect to take over the session after all connections are disconnected. same to wait-takeover in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 Defaults to 60 seconds. | -| `waitHealthCheck` _integer_ | WaitHealthCheck represents the time (in seconds) to wait for the LB to remove the source node from the list of active backend nodes. After the specified waiting time is exceeded,the rebalancing task will start. same to wait-health-check in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 Defaults to 60 seconds. | -| `absConnThreshold` _integer_ | AbsConnThreshold represents the absolute threshold for checking connection balance. same to abs-conn-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 Defaults to 1000. | -| `relConnThreshold` _string_ | RelConnThreshold represents the relative threshold for checkin connection balance. same to rel-conn-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) the usage of float highly discouraged, as support for them varies across languages. So we define the RelConnThreshold field as string type and you not float type The value must be greater than "1.0" Defaults to "1.1". | -| `absSessThreshold` _integer_ | AbsSessThreshold represents the absolute threshold for checking session connection balance. same to abs-sess-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 Default to 1000. | -| `relSessThreshold` _string_ | RelSessThreshold represents the relative threshold for checking session connection balance. same to rel-sess-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) the usage of float highly discouraged, as support for them varies across languages. So we define the RelSessThreshold field as string type and you not float type The value must be greater than "1.0" Defaults to "1.1". | - - #### ServiceTemplate diff --git a/docs/en_US/tasks/configure-emqx-rebalance.md b/docs/en_US/tasks/configure-emqx-rebalance.md index e1f8a4897..d22293206 100644 --- a/docs/en_US/tasks/configure-emqx-rebalance.md +++ b/docs/en_US/tasks/configure-emqx-rebalance.md @@ -72,7 +72,7 @@ spec: relSessThreshold: "1.1" ``` -> For Rebalance configuration, please refer to the document: [Rebalance reference](../reference/v1beta4-reference.md#rebalancestrategy). +> For Rebalance configuration, please refer to the document: [Rebalance reference](../reference/v2alpha2-reference.md#rebalancestrategy). ::: @@ -92,7 +92,7 @@ It can be seen from the figure that there are four EMQX nodes in the current clu - Submit the Rebalance task ```yaml -apiVersion: apps.emqx.io/v1beta4 +apiVersion: apps.emqx.io/v2alpha2 kind: Rebalance metadata: name: rebalance-sample @@ -137,7 +137,7 @@ $ kubectl get rebalances rebalance-sample -o json | jq '.status.rebalanceStates' "connection_eviction_rate": 10 } ``` -> For a detailed description of the rebalanceStates field, please refer to the document: [rebalanceStates reference](../reference/v1beta4-reference.md#rebalancestate). +> For a detailed description of the rebalanceStates field, please refer to the document: [rebalanceStates reference](../reference/v2alpha2-reference.md#rebalancestate). Wait for the Rebalance task to complete: diff --git a/docs/zh_CN/reference/v1beta4-reference.md b/docs/zh_CN/reference/v1beta4-reference.md index e11861f57..e25ba6d65 100644 --- a/docs/zh_CN/reference/v1beta4-reference.md +++ b/docs/zh_CN/reference/v1beta4-reference.md @@ -12,8 +12,6 @@ Package v1beta4 contains API Schema definitions for the apps v1beta4 API group - [EmqxBroker](#emqxbroker) - [EmqxEnterprise](#emqxenterprise) - [EmqxPlugin](#emqxplugin) -- [Rebalance](#rebalance) -- [RebalanceList](#rebalancelist) @@ -432,155 +430,6 @@ _Appears in:_ -#### Rebalance - - - -Rebalance is the Schema for the rebalances API - -_Appears in:_ -- [RebalanceList](#rebalancelist) - -| Field | Description | -| --- | --- | -| `apiVersion` _string_ | `apps.emqx.io/v1beta4` -| `kind` _string_ | `Rebalance` -| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | -| `spec` _[RebalanceSpec](#rebalancespec)_ | | -| `status` _[RebalanceStatus](#rebalancestatus)_ | | - - -#### RebalanceCondition - - - -RebalanceCondition describes current state of a EMQX rebalancing job. - -_Appears in:_ -- [RebalanceStatus](#rebalancestatus) - -| Field | Description | -| --- | --- | -| `type` _[RebalanceConditionType](#rebalanceconditiontype)_ | Status of rebalance condition type. one of Processing, Complete, Failed. | -| `status` _[ConditionStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#conditionstatus-v1-core)_ | Status of the condition, one of True, False, Unknown. | -| `lastUpdateTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#time-v1-meta)_ | The last time this condition was updated. | -| `lastTransitionTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#time-v1-meta)_ | Last time the condition transitioned from one status to another. | -| `reason` _string_ | The reason for the condition's last transition. | -| `message` _string_ | A human readable message indicating details about the transition. | - - -#### RebalanceConditionType - -_Underlying type:_ `string` - - - -_Appears in:_ -- [RebalanceCondition](#rebalancecondition) - - - -#### RebalanceList - - - -RebalanceList contains a list of Rebalance - - - -| Field | Description | -| --- | --- | -| `apiVersion` _string_ | `apps.emqx.io/v1beta4` -| `kind` _string_ | `RebalanceList` -| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | -| `items` _[Rebalance](#rebalance) array_ | | - - -#### RebalancePhase - -_Underlying type:_ `string` - - - -_Appears in:_ -- [RebalanceStatus](#rebalancestatus) - - - -#### RebalanceSpec - - - -RebalanceSpec represents the desired spec of Rebalance - -_Appears in:_ -- [Rebalance](#rebalance) - -| Field | Description | -| --- | --- | -| `instanceName` _string_ | InstanceName represents the name of EmqxEnterprise CR | -| `rebalanceStrategy` _[RebalanceStrategy](#rebalancestrategy)_ | RebalanceStrategy represents the strategy of EMQX rebalancing More info: https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing | - - -#### RebalanceState - - - -Rebalance defines the observed Rebalancing state of EMQX - -_Appears in:_ -- [RebalanceStatus](#rebalancestatus) - -| Field | Description | -| --- | --- | -| `state` _string_ | State represents the state of emqx cluster rebalancing. | -| `session_eviction_rate` _integer_ | SessionEvictionRate represents the node session evacuation rate per second. | -| `recipients` _string array_ | Recipients represent the target node for rebalancing. | -| `node` _string_ | Node represents the rebalancing scheduling node. | -| `donors` _string array_ | Donors represent the source nodes for rebalancing. | -| `coordinator_node` _string_ | CoordinatorNode represents the node currently undergoing rebalancing. | -| `connection_eviction_rate` _integer_ | ConnectionEvictionRate represents the node session evacuation rate per second. | - - -#### RebalanceStatus - - - -RebalanceStatus represents the current state of Rebalance - -_Appears in:_ -- [Rebalance](#rebalance) - -| Field | Description | -| --- | --- | -| `conditions` _[RebalanceCondition](#rebalancecondition) array_ | The latest available observations of an object's current state. When Rebalance fails, the condition will have type "Failed" and status false. When Rebalance is in processing, the condition will have a type "Processing" and status true. When Rebalance is completed, the condition will have a type "Complete" and status true. | -| `phase` _[RebalancePhase](#rebalancephase)_ | Phase represents the phase of Rebalance. | -| `rebalanceStates` _[RebalanceState](#rebalancestate) array_ | | -| `startedTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#time-v1-meta)_ | StartedTime Represents the time when rebalance job start. | -| `completedTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#time-v1-meta)_ | CompletedTime Represents the time when the rebalance job was completed. | - - -#### RebalanceStrategy - - - -RebalanceStrategy represents the strategy of EMQX rebalancing - -_Appears in:_ -- [RebalanceSpec](#rebalancespec) - -| Field | Description | -| --- | --- | -| `connEvictRate` _integer_ | ConnEvictRate represents the source node client disconnect rate per second. same to conn-evict-rate in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 | -| `sessEvictRate` _integer_ | SessEvictRate represents the source node session evacuation rate per second. same to sess-evict-rate in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 Defaults to 500. | -| `waitTakeover` _integer_ | WaitTakeover represents the time in seconds to wait for a client to reconnect to take over the session after all connections are disconnected. same to wait-takeover in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 Defaults to 60 seconds. | -| `waitHealthCheck` _integer_ | WaitHealthCheck represents the time (in seconds) to wait for the LB to remove the source node from the list of active backend nodes. After the specified waiting time is exceeded,the rebalancing task will start. same to wait-health-check in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 Defaults to 60 seconds. | -| `absConnThreshold` _integer_ | AbsConnThreshold represents the absolute threshold for checking connection balance. same to abs-conn-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 Defaults to 1000. | -| `relConnThreshold` _string_ | RelConnThreshold represents the relative threshold for checkin connection balance. same to rel-conn-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) the usage of float highly discouraged, as support for them varies across languages. So we define the RelConnThreshold field as string type and you not float type The value must be greater than "1.0" Defaults to "1.1". | -| `absSessThreshold` _integer_ | AbsSessThreshold represents the absolute threshold for checking session connection balance. same to abs-sess-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) The value must be greater than 0 Default to 1000. | -| `relSessThreshold` _string_ | RelSessThreshold represents the relative threshold for checking session connection balance. same to rel-sess-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing) the usage of float highly discouraged, as support for them varies across languages. So we define the RelSessThreshold field as string type and you not float type The value must be greater than "1.0" Defaults to "1.1". | - - #### ServiceTemplate diff --git a/docs/zh_CN/tasks/configure-emqx-rebalance.md b/docs/zh_CN/tasks/configure-emqx-rebalance.md index f28e94c5a..885c95fa6 100644 --- a/docs/zh_CN/tasks/configure-emqx-rebalance.md +++ b/docs/zh_CN/tasks/configure-emqx-rebalance.md @@ -73,7 +73,7 @@ spec: relSessThreshold: "1.1" ``` -> 关于 Rebalance 配置可以参考文档:[Rebalance reference](../reference/v1beta4-reference.md#rebalancestrategy)。 +> 关于 Rebalance 配置可以参考文档:[Rebalance reference](../reference/v2alpha2-reference.md#rebalancestrategy)。 ::: @@ -94,7 +94,7 @@ spec: - 提交 Rebalance 任务 ```yaml -apiVersion: apps.emqx.io/v1beta4 +apiVersion: apps.emqx.io/v2alpha2 kind: Rebalance metadata: name: rebalance-sample @@ -140,7 +140,7 @@ $ kubectl get rebalances rebalance-sample -o json | jq '.status.rebalanceStates' } ``` -> 关于 rebalanceStates 字段的详细描述可以参考文档:[rebalanceStates reference](../reference/v1beta4-reference.md#rebalancestate)。 +> 关于 rebalanceStates 字段的详细描述可以参考文档:[rebalanceStates reference](../reference/v2alpha2-reference.md#rebalancestate)。 等待 Rebalance 任务完成: