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

Commit

Permalink
Merge pull request #434 from sofastack/feat.use_beta
Browse files Browse the repository at this point in the history
使用usebeta分组分组数+1
  • Loading branch information
gold300jin authored Jan 12, 2024
2 parents bd5a950 + 2d2deaa commit 97c49a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 && moduleDeployment.Spec.Replicas-1 > 1 {
realBatchCount = batchCount + 1
} else {
realBatchCount = batchCount
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -695,7 +696,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() {
Expand Down Expand Up @@ -745,7 +746,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() {
Expand Down

0 comments on commit 97c49a2

Please sign in to comment.