Repository navigation
Conversation
setServiceOptions used fmt.Sprintf(%%f, ...) to format autoscaling Target and Utilization annotations, producing values like 100.000000 instead of 100. Knative autoscaler expects clean numeric strings. Changed to %%g which strips trailing zeros (100.0 -> 100, 70.5 -> 70.5). Also adds regression test TestSetServiceOptions_ScaleAnnotationFormat. Fixes knative#3901
%f leaves trailing zeros ("100.000000"); %g switches to exponent form
at >= 1e6 ("1e+06"). FormatFloat with 'f' and prec -1 yields the clean
decimal Knative expects ("100", "70.5", "1000000").
Signed-off-by: Luke Kingland <luke@lukekingland.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fork-internal pre-check of the rebased contributor branch for knative#3904 (author: @Elvand-Lie; authorship of the original commit preserved).
Purpose: run the full Actions suite on our fork before any force-push to the contributor's branch. Not for merge — close once the upstream push happens.
Tip:
47b58e5d5a8eOn top of the rebased contributor commit (
%g), one commit of ours switches both Target and Utilization formatting tostrconv.FormatFloat(v, 'f', -1, 64)so values stay decimal without trailing zeros or exponent form (100,70.5,1000000). Tests cover those cases. No other%f/%gautoscaling annotation formatting found inpkg/knativeorpkg/k8s.