Align pool to batch during scale up #1593
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Evan Baker rbtr@users.noreply.github.com
Reason for Change:
Currently the scale-up logic blindly adds +1 batch to whatever the current request is, meaning that if the current request is not aligned to the batch, the post scale-up pool will still not be aligned to the batch. During scale down, we calculate the skew from the batch and use that to realign the pool to a multiple of the batch.
This change copies the mod arithmetic from the scale-down so that we realign to the next greater multiple of the batch size during a scale-up. This may be within the threshold that triggers another scale-up, ie:
a pool of batch 16 with 15 IPs and 14 assignments will scale up to -> 16, which is less than the minimum free IPs, so it will scale up again to 32 on the next tick. This behavior is seen when coming out of a constrained subnet state, when the batch would have been temporarily adjusted to 1 and thus the requested IP count could be anything.
Issue Fixed:
Requirements:
Notes: