-
Notifications
You must be signed in to change notification settings - Fork 40.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
API returns numbers from get that it can't parse when fed into update #4041
Comments
It looks like Quantity is unmarshalling wrong? On Mon, Feb 2, 2015 at 6:10 PM, Alex Robinson [email protected]
|
That's very likely. And sorry, I didn't realize yaml didn't paste into comments well. Here's the actual yaml:
|
Yeah, on the client-side, apparently, since the error is in kubectl/cmd/resource.go. It's possible that was missed during the Quantity refactoring. It may be troublesome that the v1beta1 API accepts a util.IntOrString for resources rather than a Quantity: |
/cc @vishh |
The (external) yaml library that we use is the cause for this. I will send a patch to fix the yaml library. |
Sent a PR to our yaml dependency. |
If we are only fixing our yaml unmarshalling, we are still losing precision. E.g. Both of these are pretty small problems, but it seems silly to needlessly lose precision. |
Resource quantities must be lossless. On Wed, Feb 4, 2015 at 11:20 AM, CJ Cullen [email protected] wrote:
|
+1. These are supposed to be strings, not integers nor floats. |
What does |
|
That does look like an API bug. It should be a string, IIUC. |
Legacy CPU and memory are int and int64, respectively. |
This can't possibly work. IntOrString is a 32-bit signed int. This value doesn't fit in 32 bits. |
Yes - this isn't a problem with the YAML library. This is a problem with trying to render a number larger than 32 bits (4026531840) as a 32-bit integer (IntOrString), which instead ends up rendering as a floating point. #2264 (or something that keeps this value as a 64-bit integer the whole time) is the right fix. |
@ghodss: The yaml library converts an |
@ghodss: Even an int32 gets marshaled into a floating point number. I don't see how that is valid. The underlying golang |
IntOrString stores things as "int", which is 32 or 64 bits depending on the platform. We should explicitly use int32 or int64 in our api objects. These values should be stored as a Quantity in v1beta3, and converted to a string in v1beta1 & 2. |
@dbsmith: Ack On Fri, Feb 13, 2015 at 1:29 PM, Daniel Smith [email protected]
|
If someone changed IntOrString to use int64 I would approve. On Fri, Feb 13, 2015 at 1:32 PM, Vish Kannan [email protected]
|
I spin up a new cluster using GKE at version 0.9.2. Then I run:
$kubectl get minion -o yaml > minion.yaml
This returns a yaml file:
apiVersion: v1beta1
creationTimestamp: 2015-02-03T01:16:46Z
hostIP:
id:
kind: Node
labels:
diskSize: "massive"
resourceVersion: 12
resources:
capacity:
cpu: "1"
memory: 4.0265318e+09
selfLink: /api/v1beta1/minions/
status:
conditions:
lastTransitionTime: null
status: Full
uid: 526a4156-ab42-11e4-9817-42010af0258d
I delete the hostIp and status so that the update request won't get rejected (#3005 should fix that), then run:
$ kubectl update -f minion.yaml
ERROR: F0202 18:08:19.054514 767 resource.go:212] error unmarshaling JSON: json: cannot unmarshal number 4.0265318e+09 into Go value of type int
I'm not sure whether the marshaling or the unmarshaling is what needs to be fixed, but the API shouldn't be returning numbers that it can't parse.
The text was updated successfully, but these errors were encountered: