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

使用usebeta分组分组数+1 #434

Merged
merged 4 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading