Skip to content
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

[enhancement] Should not use Float in CRD definition. #889

Open
gaocegege opened this issue Oct 22, 2019 · 8 comments
Open

[enhancement] Should not use Float in CRD definition. #889

gaocegege opened this issue Oct 22, 2019 · 8 comments

Comments

@gaocegege
Copy link
Member

/kind feature

Describe the solution you'd like
[A clear and concise description of what you want to happen.]

Ref kubernetes-sigs/controller-tools#245

so, it's technically supported, but floats are highly discouraged (and disallowed in official kubernetes APIs) because they won't round-trip properly, can't actually represent certain numbers exactly, etc (all the normal reasons floats are usually not what you want in a program). We recommend using resource.Quantity or int32 for your numeric types, in accordance with the Kubernetes API conventions.

Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]

@gaocegege
Copy link
Member Author

/priority p3

@gaocegege
Copy link
Member Author

We can use https://golang.org/src/encoding/json/decode.go#L187 json.Number.

@issue-label-bot
Copy link

Issue Label Bot is not confident enough to auto-label this issue.
See dashboard for more details.

@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the labels:

Label Probability
area/front-end 0.83

Please mark this comment with 👍 or 👎 to give our bot feedback!
Links: app homepage, dashboard and code for this bot.

@andreyvelich
Copy link
Member

@gaocegege Is it better than just a simple string, like we did with metrics values ?

@gaocegege
Copy link
Member Author

json.Number is a wrapper of string. We can use string, too.

@stale
Copy link

stale bot commented Nov 24, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@andreyvelich
Copy link
Member

/lifecycle frozen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants