From 815cf0d0374a0f6e50f9437f068fa86344c9e734 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Wed, 3 Jan 2024 15:46:03 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BD=BF=E7=94=A8usebeta=E5=88=86=E7=BB=84?= =?UTF-8?q?=E5=88=86=E7=BB=84=E6=95=B0+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/controller/moduledeployment_controller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/module-controller/internal/controller/moduledeployment_controller.go b/module-controller/internal/controller/moduledeployment_controller.go index c032b9781..6750d82ea 100644 --- a/module-controller/internal/controller/moduledeployment_controller.go +++ b/module-controller/internal/controller/moduledeployment_controller.go @@ -214,10 +214,13 @@ func handleInitModuleDeployment(moduleDeployment *v1alpha1.ModuleDeployment, new ) batchCount := moduleDeployment.Spec.OperationStrategy.BatchCount + useBeta := moduleDeployment.Spec.OperationStrategy.UseBeta if batchCount <= 0 { realBatchCount = 1 } else if int32(math.Abs(float64(deltaReplicas))) < batchCount { realBatchCount = int32(math.Abs(float64(deltaReplicas))) + } else if useBeta { + realBatchCount = batchCount + 1 } else { realBatchCount = batchCount } From 2e1dba0f6ba8540b867757a6da5296acf53edca8 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Wed, 3 Jan 2024 15:57:03 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BD=BF=E7=94=A8usebeta=E5=88=86=E7=BB=84?= =?UTF-8?q?=E5=88=86=E7=BB=84=E6=95=B0+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/controller/moduledeployment_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-controller/internal/controller/moduledeployment_controller.go b/module-controller/internal/controller/moduledeployment_controller.go index 6750d82ea..9cc913d56 100644 --- a/module-controller/internal/controller/moduledeployment_controller.go +++ b/module-controller/internal/controller/moduledeployment_controller.go @@ -219,7 +219,7 @@ func handleInitModuleDeployment(moduleDeployment *v1alpha1.ModuleDeployment, new realBatchCount = 1 } else if int32(math.Abs(float64(deltaReplicas))) < batchCount { realBatchCount = int32(math.Abs(float64(deltaReplicas))) - } else if useBeta { + } else if useBeta && moduleDeployment.Spec.Replicas-1 > 1 { realBatchCount = batchCount + 1 } else { realBatchCount = batchCount From 317c3e323f8e528e8b7098af8366158bd5ae3a02 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Tue, 9 Jan 2024 14:59:40 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=95=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oduledeployment_controller_operation_strategy_suit_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module-controller/internal/controller/moduledeployment_controller_operation_strategy_suit_test.go b/module-controller/internal/controller/moduledeployment_controller_operation_strategy_suit_test.go index 42587249a..d098a3782 100644 --- a/module-controller/internal/controller/moduledeployment_controller_operation_strategy_suit_test.go +++ b/module-controller/internal/controller/moduledeployment_controller_operation_strategy_suit_test.go @@ -695,7 +695,7 @@ var _ = Describe("ModuleDeployment Controller OperationStrategy Test", func() { It("2. check if use Beta strategy", func() { Eventually(func() error { return checkModuleDeploymentReplicas(nn, 1) - }) + }, timeout, interval).Should(Succeed()) }) It("3. clean environment", func() { @@ -745,7 +745,7 @@ var _ = Describe("ModuleDeployment Controller OperationStrategy Test", func() { It("2. check if use Beta strategy", func() { Eventually(func() error { return checkModuleDeploymentReplicas(nn, 1) - }) + }, timeout, interval).Should(Succeed()) }) It("3. clean environment", func() { From 2d2deaaeb309ff01bab04ce07c7a8408edd9bfe4 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 11 Jan 2024 16:11:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=8D=95=E6=B5=8B=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moduledeployment_controller_operation_strategy_suit_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/module-controller/internal/controller/moduledeployment_controller_operation_strategy_suit_test.go b/module-controller/internal/controller/moduledeployment_controller_operation_strategy_suit_test.go index d098a3782..4933e6532 100644 --- a/module-controller/internal/controller/moduledeployment_controller_operation_strategy_suit_test.go +++ b/module-controller/internal/controller/moduledeployment_controller_operation_strategy_suit_test.go @@ -29,6 +29,7 @@ var _ = Describe("ModuleDeployment Controller OperationStrategy Test", func() { deployment := prepareDeployment(namespace) moduleDeploymentName := "module-deployment-test-demo" moduleDeployment := utils.PrepareModuleDeployment(namespace, moduleDeploymentName) + moduleDeployment.Spec.OperationStrategy.BatchCount = 4 pod := preparePod(namespace, "fake-pod-1") Context("create module deployment", func() { It("prepare deployment and pod", func() {