Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit 97c49a2

Browse files
authored
Merge pull request #434 from sofastack/feat.use_beta
使用usebeta分组分组数+1
2 parents bd5a950 + 2d2deaa commit 97c49a2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

module-controller/internal/controller/moduledeployment_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,13 @@ func handleInitModuleDeployment(moduleDeployment *v1alpha1.ModuleDeployment, new
214214
)
215215

216216
batchCount := moduleDeployment.Spec.OperationStrategy.BatchCount
217+
useBeta := moduleDeployment.Spec.OperationStrategy.UseBeta
217218
if batchCount <= 0 {
218219
realBatchCount = 1
219220
} else if int32(math.Abs(float64(deltaReplicas))) < batchCount {
220221
realBatchCount = int32(math.Abs(float64(deltaReplicas)))
222+
} else if useBeta && moduleDeployment.Spec.Replicas-1 > 1 {
223+
realBatchCount = batchCount + 1
221224
} else {
222225
realBatchCount = batchCount
223226
}

module-controller/internal/controller/moduledeployment_controller_operation_strategy_suit_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var _ = Describe("ModuleDeployment Controller OperationStrategy Test", func() {
2929
deployment := prepareDeployment(namespace)
3030
moduleDeploymentName := "module-deployment-test-demo"
3131
moduleDeployment := utils.PrepareModuleDeployment(namespace, moduleDeploymentName)
32+
moduleDeployment.Spec.OperationStrategy.BatchCount = 4
3233
pod := preparePod(namespace, "fake-pod-1")
3334
Context("create module deployment", func() {
3435
It("prepare deployment and pod", func() {
@@ -695,7 +696,7 @@ var _ = Describe("ModuleDeployment Controller OperationStrategy Test", func() {
695696
It("2. check if use Beta strategy", func() {
696697
Eventually(func() error {
697698
return checkModuleDeploymentReplicas(nn, 1)
698-
})
699+
}, timeout, interval).Should(Succeed())
699700
})
700701

701702
It("3. clean environment", func() {
@@ -745,7 +746,7 @@ var _ = Describe("ModuleDeployment Controller OperationStrategy Test", func() {
745746
It("2. check if use Beta strategy", func() {
746747
Eventually(func() error {
747748
return checkModuleDeploymentReplicas(nn, 1)
748-
})
749+
}, timeout, interval).Should(Succeed())
749750
})
750751

751752
It("3. clean environment", func() {

0 commit comments

Comments
 (0)