From f70abca961e1571b8c46d3036cbad67b690a7f99 Mon Sep 17 00:00:00 2001 From: David Grove Date: Fri, 3 May 2024 16:55:22 -0400 Subject: [PATCH] bug fix in MinAvailable usage: 0 should be interpreted as 1 (#161) --- internal/controller/resource_manager.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/controller/resource_manager.go b/internal/controller/resource_manager.go index ce967d9..cb10019 100644 --- a/internal/controller/resource_manager.go +++ b/internal/controller/resource_manager.go @@ -178,8 +178,12 @@ func (r *AppWrapperReconciler) isSuccessful(ctx context.Context, appWrapper *mca } } } - // To succeed we need to pass the custom completionstatus check or have enough successful pods if MinAvailable > 0 - return custom || appWrapper.Spec.Scheduling.MinAvailable > 0 && counts.Succeeded >= int(appWrapper.Spec.Scheduling.MinAvailable), nil + // To succeed we need to pass the custom completion status check or have enough successful pods if MinAvailable >= 0 + targetSucceeded := 1 + if appWrapper.Spec.Scheduling.MinAvailable > int32(targetSucceeded) { + targetSucceeded = int(appWrapper.Spec.Scheduling.MinAvailable) + } + return custom || (appWrapper.Spec.Scheduling.MinAvailable >= 0 && counts.Succeeded >= targetSucceeded), nil } // Delete wrapped resources, forcing deletion of pods and wrapped resources if enabled