scheduled-scaling: Handle mili values (fractions) in target value #846
+21
−11
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.
This fixes a bug where the logic for adjusting scheduled scaling when the change is less than 10% didn't deal with fractions (mili values) correctly.
Example:
Scaling Schedule had the target value of:
7875HPA had the current number of replicas:
637target on the HPA:
11720m == 11.72With this the expected number of replicas would be:
ceil(7875/11.72) = 672, a change of0.0548which is within the default0.1toleration, such that the adjuster should kick in.However, due to the bug, the target value
11.72was rounded off to11in the calculation such that the expected number of replicas wasceil(7875/11) = 716which is a change of0.1239, above the default0.1toleration, so the adjuster assumed the HPA would scale.The fix is to correctly convert the target to a float not loosing the decimals.