Repository navigation
api: validate VMI checksum status fields as uint32 range - #17469
Conversation
|
Skipping CI for Draft Pull Request. |
VMI checksum status fields are uint32, but generated CRD validation used int32, which could reject valid large checksum values and fail status updates. Define checksum validation on the API fields via kubebuilder markers and regenerate outputs so checksum schema uses int64 with explicit uint32 bounds. Assisted-by: Cursor Signed-off-by: Or Shoval <[email protected]>
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="staging/src/kubevirt.io/api/core/v1/types.go" line_range="407-409" />
<code_context>
// KernelInfo show info about the kernel image
type KernelInfo struct {
+ // +kubebuilder:validation:Format:=int64
+ // +kubebuilder:validation:Minimum:=0
+ // +kubebuilder:validation:Maximum:=4294967295
// Checksum is the checksum of the kernel image
Checksum uint32 `json:"checksum,omitempty"`
</code_context>
<issue_to_address>
**issue (bug_risk):** Kubebuilder marker syntax uses `=` rather than `:=`, which may prevent these validations from being applied.
Using `:=` instead of `=` for these validation markers (`Format`, `Minimum`, `Maximum`) will likely cause controller-tools to skip them when generating CRDs. Please update all affected markers (including those on `KernelInfo`, `InitrdInfo`, and `ContainerDiskInfo`) to use `=` so the schema validations are applied as intended.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@oshoval Hi, the error message: Is a bit misleading, are you sure it was an issue related to overflow rather than checksum with |
You are right the print is misleading, but the value was indeed > max int32, while lower than max unit32
0 was and still valid value according the manifest, it aint the problem without the fix, failed 2/2, with fix pass always max int32 = 2,147,483,647 will drop the release note, not crucial - done |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enp0s3 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Thanks Igor |
|
Required labels detected, running phase 2 presubmits: |
|
thanks, do we really need the hold ? if some one would like he has time until the CI finish, and worst case we can create follow-up please imho |
|
/hold cancel |
|
/retest-required |
| maximum: 4294967295 | ||
| minimum: 0 |
There was a problem hiding this comment.
The status field is uint32, but CRD schema expresses it as int64, so we explicitly constrain it to 0..4294967295 to preserve the API contract, in explicit way.
This also future-proofs the schema: if checksum generation changes later, validation will still enforce the expected uint32 range instead of silently accepting out-of-range values.
|
/cherry-pick release-1.8 |
|
@a7i: only kubevirt org members may request cherry picks. If you are already part of the org, make sure to change your membership to public. Otherwise you can still do the cherry-pick manually. DetailsIn 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. |
Reverts b767b9c. The helper was added to work around what looked like the virt-handler containerdisk-socket race on k8s 1.36, but the actual root cause is unrelated: k8s 1.36's stricter CRD numeric format validation (kubernetes/kubernetes#136582) rejects VMI status updates with the pre-fix uint32 Checksum schema. See kubevirt/kubevirt#17858 for the upstream context and kubevirt/kubevirt#17469 for the upstream fix (merged to main, included in v1.9.0-alpha.0, not in v1.8.x). The follow-up commit bumps KUBEVIRT_VERSION so the test consumes a KubeVirt release that contains the fix, which removes the need for any test-side retry.
KubeVirt v1.8.2 publishes VMI status checksum fields (uint32 in Go) as format: int32 in its generated CRD schema. k8s 1.36 enables strict numeric format validation in CRDs via kubernetes/kubernetes#136582, which now rejects the legacy schema and causes virt-handler to enter an infinite VMI status update re-enqueue loop. Live migrations never complete and the descheduler e2e TestLiveMigrationInBackground times out. The schema fix landed upstream in kubevirt/kubevirt#17469 (merged to main on 2026-04-18, included in v1.9.0-alpha.0 tagged 2026-05-11) but was not backported to release-1.8, so no v1.8.x release contains it. Bump the default KUBEVIRT_VERSION to v1.9.0-alpha.0 so the e2e suite consumes a release whose generated CRDs are compatible with k8s 1.36's stricter validator. Tracked in kubevirt/kubevirt#17858.
|
/cherrypick release-1.8 |
|
@fossedihelm: new pull request created: #18055 DetailsIn 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. |
What this PR does
Before this PR:
int32in generated CRD schema.2147483647could be rejected during status updates.After this PR:
kernelInfo,initrdInfo,containerDiskVolume) using kubebuilder markers.int64with explicit uint32 bounds (0..4294967295).Why we need it and why it was done in this way
Without it, VMs failed to start locally, due to checksum being bigger than max int32.
Release note