-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Parsing different quantity formats #1895
Comments
I think we have a class, try searching class named |
The class is there - https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-model/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/Quantity.java - but it doesn't actually "parse" it into a proper typed value. |
To clarify I was looking for something equivalent to https://github.com/kubernetes-client/java/blob/master/kubernetes/src/main/java/io/kubernetes/client/custom/Quantity.java So that client can have behavior like Quantity (".5Mi") equals Quantity ("512Ki") |
Yes, I do think it's a valuable addition. Our Quanity.java has been deprecated as per latest kubernetes releases. We need to modify it. Actually it's already there in model for parsing go structs, but https://github.com/kubernetes/apimachinery/blob/adc6f4cd9e7d28fc1c1e5efc658d940d55c0f356/pkg/api/resource/quantity.go doesn't follow standard kubernetes types format. Our go script assumes all structs in types.go, I think we need to manually generate Quantity.java for this to work. |
seemd related to #885 |
Added a normalize method and equals() method so that Quantity objects could be compared by converting to normalized versions.
@avmohan : Hi, I've created a PR to support this use case of comparing different Quantity objects of different formats. Could you please see if this would fulfil your use case or you are looking for something more flexible(like converting Quantities from one to other as implemented in official client)? |
Thanks @rohanKanojia . This would work. |
Is there an equivalent of https://github.com/kubernetes/apimachinery/blob/adc6f4cd9e7d28fc1c1e5efc658d940d55c0f356/pkg/api/resource/quantity.go in java?
The text was updated successfully, but these errors were encountered: