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

Commit f70abca

Browse files
authored
bug fix in MinAvailable usage: 0 should be interpreted as 1 (#161)
1 parent 93e3422 commit f70abca

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: internal/controller/resource_manager.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,12 @@ func (r *AppWrapperReconciler) isSuccessful(ctx context.Context, appWrapper *mca
178178
}
179179
}
180180
}
181-
// To succeed we need to pass the custom completionstatus check or have enough successful pods if MinAvailable > 0
182-
return custom || appWrapper.Spec.Scheduling.MinAvailable > 0 && counts.Succeeded >= int(appWrapper.Spec.Scheduling.MinAvailable), nil
181+
// To succeed we need to pass the custom completion status check or have enough successful pods if MinAvailable >= 0
182+
targetSucceeded := 1
183+
if appWrapper.Spec.Scheduling.MinAvailable > int32(targetSucceeded) {
184+
targetSucceeded = int(appWrapper.Spec.Scheduling.MinAvailable)
185+
}
186+
return custom || (appWrapper.Spec.Scheduling.MinAvailable >= 0 && counts.Succeeded >= targetSucceeded), nil
183187
}
184188

185189
// Delete wrapped resources, forcing deletion of pods and wrapped resources if enabled

0 commit comments

Comments
 (0)