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

Commit

Permalink
bug fix in MinAvailable usage: 0 should be interpreted as 1 (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrove-oss authored May 3, 2024
1 parent 93e3422 commit f70abca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/controller/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f70abca

Please sign in to comment.