Skip to content

Commit 78a7235

Browse files
committed
fix: stop/start ops always running when component replicas is 0
1 parent d144cac commit 78a7235

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/operations/ops_comp_helper.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func (c componentOpsHelper) reconcileActionWithComponentOps(reqCtx intctrlutil.R
286286
if expectCount != completedCount {
287287
opsIsCompleted = false
288288
} else if !pgResource.noWaitComponentCompleted &&
289-
(!slices.Contains(componentTerminalPhases(), componentPhase) || completedCount == 0) {
289+
(!slices.Contains(componentTerminalPhases(), componentPhase) || noAnyProgressCompleted(pgResource.clusterComponent.Replicas, completedCount)) {
290290
opsIsCompleted = false
291291
}
292292
opsCompStatus.Phase = componentPhase
@@ -308,6 +308,10 @@ func (c componentOpsHelper) reconcileActionWithComponentOps(reqCtx intctrlutil.R
308308
return opsv1alpha1.OpsSucceedPhase, 0, nil
309309
}
310310

311+
func noAnyProgressCompleted(replicas, completedCount int32) bool {
312+
return replicas > 0 && completedCount == 0
313+
}
314+
311315
func hasIntersectionCompOpsList[T ComponentOpsInterface, S ComponentOpsInterface](currCompOpsMap map[string]T, list []S) bool {
312316
for _, comp := range list {
313317
if _, ok := currCompOpsMap[comp.GetComponentName()]; ok {

0 commit comments

Comments
 (0)