-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected handling of integer/long parameters #1779
Comments
I'm pretty sure this is a yaml-problem. Please try using a string as the default:
Yaml (as json) do not really support >32bit integers, you have to quote them as strings. Blame JavaScript for it ;) |
The value I tested with is a valid 32-bit integer (432,000,000). |
Good point. After looking into it, it's a go Problem. Go's default formatting uses scientific formatting sometimes, for some reason. See https://stackoverflow.com/questions/41159492/format-float-in-golang-html-template We now could pre-format the value before rendering the template, but the issue is, some users might need access to the raw value. The only solution I see for now is to use custom formatting:
Which is kind of annoying, or to use quotes around the Parameter default value, which would prevent the yaml parser to parse this as a number. |
Oh, and there is no type "long" in KUDO - In the linked PR I added validation that would throw a validation error. Type integer is actually correct and includes 32 and 64bit long integers. And these should be rendered correctly without explicit formatting. |
What happened:
Defined a parameter of type
integer
with a default value:Packaging the operator resulted in this error:
Changed the type to
long
which solved the first error. But when the param is used in a template:It is rendered as:
Same thing happens when trying this:
What you expected to happen:
The default value of an integer parameter should not be parsed as a float.
When rendering an integer or long, it should not be formatted using scientific notation.
How to reproduce it (as minimally and precisely as possible):
kubectl-kudo package create ./operator --destination /tmp
Anything else we need to know?:
It's not clear if integer/long types are actually supported.
The docs show only
array
andmap
types: https://kudo.dev/docs/developing-operators/parameters.html#declaring-parametersYet this KEP (#988) has been completed and kudo allows
integer
andlong
params to be defined.Environment:
kubectl version
): 1.19.3kubectl kudo version
): 0.18.2The text was updated successfully, but these errors were encountered: