-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
format_quantity
function missing to convert Decimal values in to K8s quantity string
#2205
Comments
/help |
@roycaihw: GuidelinesPlease ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met. If this request no longer meets these requirements, the label can be removed In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hi @roycaihw, thanks for looking into my request. I'm sorry that it took me a while to come back to you. I'm not entirely sure, on which aspect my help is needed. Maybe it my description for the desired function was not quite clear. So let me try again:
I opened the issue to ask if such a function is desired and since, I've already implemented it for my own project, I want to contribute. To illustrate my request a bit more, I've no created a draft PR for the function, so that you can have a look (there is also an example how to use the function): #2216 Please let me know if you're in favor of the change. Then I'll convert into an actual PR and sign the CLA. I'm removing the 'help wanted', since to indicate that I've replied to your request. /remove-help |
Hi @rkschamer, the feature sounds good! Please feel free to convert the draft to an actual PR and we can review and merge it |
Thanks, @roycaihw! I've now added tests and converted to an actual PR. Please feel free to review the PR. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
From my point of view, this PR is still valid. I'm just awaiting a code review. I'm sorry about the extend of the PR. Majority of the changes is in tests. I could reduce, if you want. /remove-lifecycle stale |
Could this feature be merged in? This seems really helpful. Thanks for making this @rkschamer People on Stack Overflow are suggesting to roll your own converter from '100m' to decimal and back and that's obviously less than ideal from a maintainability standpoint, it seems like only Golang has code in it to convert both ways. |
@superlazyname, I'd be very happy if my PR #2216 could be merged. I'm just waiting for a review from @roycaihw, who is assigned to it. |
What is the feature and why do you need it:
There is
parse_quantity
to convert a canonical K8s quantity into aDecimal
value. However, an opposite function, likeformat_quantity
is missing, making it hard to transform a Decimal into a K8s quantity.My use case was that I needed to load the resource requirements of serval pods, finding the maximum value and setting it for all pods. Due to potentially different SI suffixes, I've used
parse_quantity
, however setting the resource requirements for all other Pods, requires me to convert back from aDecimal
into a canonical K8s quantity.Describe the solution you'd like to see:
So far, I've implemented the function in my project, but I think that might be something also others could benefit. For this reason, I'd like to open a pull request to contribute this function.
Tasks
The text was updated successfully, but these errors were encountered: