Files
fengcone 1ea4e38580 feat(kubernetes): add QEMU VMState pause and resume (#1584)
* feat(kubernetes): add QEMU VMState pause and resume

Add opt-in process-level pause and resume support for QEMU running inside
runc sandboxes.

- capture the outer rootfs and writable qcow2 overlay in the rootfs image
- export guest memory, vCPU, and device state through QMP migration
- package compressed VMState as a separate OCI image
- restore rootfs and VMState exclusively through immutable image digests
- support pooled BatchSandbox pause, detachment, and standalone restoration
- add authenticated Registry credentials for snapshot push and restore pull
- add QEMU checkpoint, recovery, VMState loading, and compatibility contracts
- simplify the E2E guest to expose mmap and disk markers through HTTP
- verify Guest memory, qcow2, outer rootfs, boot ID, and counter continuity
- add private samples, operational documentation, and Kind/KVM validation
- preserve existing rootfs-only pause and resume behavior

* docs(kubernetes): clarify QEMU VMState design and operations

* fix(kubernetes): preserve HostPID and SOURCE_POD_UID in snapshot jobs

Two omissions introduced during the QEMU VMState cherry-pick:

- applyImageCommitterPodTemplate overwrote HostPID with the overlay default (false), causing QEMU commit jobs to lose host PID access required for nerdctl exec into the QEMU container.
- ensureUnpauseJob accepted sourcePodUID but did not inject it into the unpause job env, breaking the SOURCE_POD_UID security contract that lets image-committer match containers by pod UID on unpause.

* fix(kubernetes): address snapshot review findings

* fix(kubernetes): resolve golint issues in snapshot code

* fix(kubernetes): harden QEMU restore init container security and storage

* fix(kubernetes): mark ResumeFailed when pod failures race the Resuming phase

Under informer lag, pod failures observed during a resume can be
classified while the cached BatchSandbox phase still shows the pre-pause
steady phase, so the failure path skipped the ResumeFailed condition and
only reported PodFailed. Detect an in-flight resume via generation and
spec in the steady failure branch and set ResumeFailed as well.

Also make the e2e ResumeFailed assertion poll instead of checking once.

* test(kubernetes): dump cluster diagnostics when pause-resume e2e specs fail

Flaky pause/resume CI failures left no controller or object state behind
because the kind cluster is torn down right after the suite. Dump
BatchSandbox/SandboxSnapshot/Job/Pod state, events, and controller logs
to GinkgoWriter whenever a spec fails.

* ci(e2e): wipe stale mavenLocal SDK artifacts before Java E2E

The self-hosted runner's shared ~/.m2 can contain a higher-versioned
com.alibaba.opensandbox jar published by another job, and tests/java
resolves 'latest.integration' from mavenLocal, so compilation fails
with missing Builder methods (e.g. reconcileInterval). Remove the group
directory before publishing so tests resolve the freshly built SDK.

---------

Co-authored-by: Sky <yutian.taoyt@alibaba-inc.com>
2026-08-21 13:26:08 +08:00
..