-
Notifications
You must be signed in to change notification settings - Fork 450
Avoid unintentional patches to Quantity fields #7430
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
base: main
Are you sure you want to change the base?
Conversation
|
|
|
Welcome @brejman! |
|
Hi @brejman. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
|
/ok-to-test |
1c9b01f to
4a217ac
Compare
|
/retest |
| binary := *resource.NewQuantity(v, resource.BinarySI) | ||
| final, err := resource.ParseQuantity(binary.String()) | ||
| if err != nil { | ||
| // Should never happen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log the error so that we can find out debugging that it went wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, this would never happen as the resource.Quantity binary was serialized by the library function, so it would need to be an internal serialization / deserialization bug in the library. I think this it is ok to assume this does not fail. In the worst case scenario we fallback to "binary" as before.
Otherwise we would need to propagate the logger via 20 or so functions. So, I'm ok to avoid the complication for this case.
|
@brejman please check locally (without putting all the cases here) if this change addresses all the known problematic variants listed under the issue: #6966, in the PR: https://github.com/olekzabl/kueue/blob/38eef366ed6a3e6b64b08ab8c9800abc20d5cca3/test/integration/singlecluster/controller/admissionchecks/provisioning/provisioning_test.go#L1848-L1977 |
|
/lgtm Feel free to unhold if you confirm all cases are addressed by this change, as requested here: #7430 (comment) |
|
@mimowo: once the present PR merges, I will cherry-pick it on top of 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-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brejman, mimowo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| resource: corev1.ResourceMemory, | ||
| value: 1500000, | ||
| expected: "1500k", | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question, what it means "round-trips" in this context, since the serialization looks different: "1.5M" vs "1500k"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case name doesn't participate in the test logic. The initial value is int64 and not a string. I just found the 1.5 string easier to read, in particular for MiB.
I think if we parsed a string "1.5M", it wouldn't roundtrip and would serialize back to "1500k". But it's not a problem, because "1.5M" could only be provided as an input which is then converted to int64 before being sent to the API, and after that conversion it consistently roundtrips.
I updated the test case name
|
Actually, also have this question: https://github.com/kubernetes-sigs/kueue/pull/7430/files#r2480708605 |
|
/lgtm cancel |
The change from no-suffix to decimal suffix doesn't seem to be detected as a diff anymore and I can't seem to reproduce the issue, even on older repo revisions, where I'm confident I was able to in the past. I'm taking a deeper look. |
|
I checked again and it does reproduce on an old revision. #7369 makes it not reproducible. Still looking into why. |
|
interesting maybe the additional layer of convertion webhooks somehow fixes the issue by additional serialization/deserialization step. If this is confirmed your PR is still worth it, bevause it will allow to fix 0.13 and 0.14. and also the issue would return when we move storage to v1beta2 and thus drop convertion webhooks again |
What type of PR is this?
/kind bug
What this PR does / why we need it:
In case the job requests memory in decimal format (e.g. "1G"), the Workload's
status.admission.podSetAssignments[].resourceUsage.memoryis unintentionally patched due to Quantity round trip issues.For example:
This PR changes no.3 to auto-detect the format and avoid unintentional diff.
While normally such diff shouldn't really matter other than adding some noise in managed fields, it hits kubernetes/kubernetes#134902, which makes the workload impossible to evict.
Which issue(s) this PR fixes:
Fixes #6966
Special notes for your reviewer:
This change makes it much more expensive to compute the Quantity.
I've considered a couple of alternatives:
Does this PR introduce a user-facing change?