Skip to content

microvm: DataOnGolden snapshot scope - commit Data, resume on the golden snapshot (#451, phase 1) - #683

Open
Dmitry Berkovich (dberkov) wants to merge 2 commits into
agent-substrate:mainfrom
dberkov:data_on_golden_resume
Open

microvm: DataOnGolden snapshot scope - commit Data, resume on the golden snapshot (#451, phase 1)#683
Dmitry Berkovich (dberkov) wants to merge 2 commits into
agent-substrate:mainfrom
dberkov:data_on_golden_resume

Conversation

@dberkov

Copy link
Copy Markdown
Collaborator

Phase 1 of #451, micro-VM only. gVisor support will follow in a separate PR.

What

Adds a new ActorTemplate snapshot scope, DataOnGolden, valid for onCommit only and gated to sandboxClass: microvm by CRD CEL validation.

Semantics: DataOnGolden is a restore-time behavior. At suspend the actor captures exactly what Data captures (durable-dir volumes only), and the ActorSnapshot records plain Data/Full content — nothing new is stored on the snapshot. At resume, the control plane derives the behavior from the template's onCommit: a Data snapshot under a DataOnGolden template restores by combining the template's golden snapshot (guest memory + full fs delta) with the actor's captured data.

How

  • CRD (pkg/api/v1alpha1): DataOnGolden enum value; CEL rules forbid it on onPause and on gVisor templates; the existing onCommit-subset-of-onPause rule already yields the right semantics.
  • Control plane (ateapi): suspend maps the commit scope to its capture scope (DataOnGoldenData) before calling atelet and before stamping ContentScope. Resume resolves the golden snapshot's location when onCommit is DataOnGolden and the snapshot holds Data, failing early (with an actionable error) if the golden snapshot is missing or not Full. Golden actors themselves always commit Full regardless of onCommit — their snapshot is the base the combine needs.
  • Wire APIs (ateletpb/ateompb): a restore-only SNAPSHOT_SCOPE_DATA_ON_GOLDEN plus golden_snapshot_uri_prefix on ExternalCheckpointConfiguration; atelet rejects both on checkpoint requests.
  • atelet: on a DataOnGolden restore, fetches both snapshot manifests and stages a single combined folder — the actor's files (the durable-dir tar) win name collisions, the golden snapshot supplies the rest — downloading from both URI prefixes concurrently. The golden manifest's pinned sandbox binaries run the restored guest and are recorded on-node for later checkpoints.
  • ateom-microvm: DATA_ON_GOLDEN restores through the existing Full path — cloud-hypervisor relaunches from the golden's guest files while the durable virtio-fs share serves the actor's re-materialized data. gVisor rejects the scope (defense-in-depth behind the CRD gate).

Testing

  • Unit: envtest CEL cases, converter tables, atelet request validation (incl. checkpoint rejection and golden-URI rules), combined-download test against a fake object store, resume-workflow golden-resolution cases.
  • e2e (suites/demo): DataOnGolden lifecycle cases (single and two durable volumes, micro-VM lane only) asserting counters across pause/suspend and that the suspend recorded plain Data content.
  • Manually verified on a live cluster: commit → resume-on-different-pod continues the file counter with the golden guest's memory.

🤖 Generated with Claude Code

DataOnGolden is a restore-time behavior: at commit the actor captures
the same content as Data, and at resume the ActorTemplate's golden
snapshot (memory + full fs delta) is combined with the actor's captured
data. This change adds the CRD enum value with CEL validation
(onCommit-only, sandboxClass microvm only), plumbs the restore-only
DATA_ON_GOLDEN scope through the atelet/ateom APIs, and threads the
golden snapshot location through the Restore path as
golden_snapshot_uri_prefix on ExternalCheckpointConfiguration.

The snapshot record stays truthful about content: a DataOnGolden commit
is captured and recorded as plain Data, and resume derives the
golden-combine from the template's onCommit. Golden actors always
commit with Full scope regardless of onCommit — the golden snapshot is
the base a DataOnGolden restore combines into — and resume validates
the golden's recorded scope, failing with an actionable error on a
non-Full golden.

Combining the two sources is not implemented yet: ateom-microvm rejects
DataOnGolden restores with Unimplemented, and atelet only validates and
forwards the golden location without downloading from it.
atelet stages the combined restore set into a single folder: every file
of the actor's own snapshot (the durable-dir tar) plus the golden
snapshot's files the actor's set does not shadow (guest memory + VM
state), downloaded concurrently from both URI prefixes. The golden
manifest's pinned sandbox binaries run the restored guest — the golden
memory image must be resumed by the binaries that created it — and are
recorded on-node for later checkpoints.

ateom-microvm drops the Unimplemented stub: DATA_ON_GOLDEN now flows
through the Full restore path, so the golden guest resumes over the
actor's durable-dir data through the durable virtio-fs share.

The counter-microvm demo commits with DataOnGolden to exercise the
combined restore, and the demo e2e suite covers the lifecycle (plus a
two-durable-volume variant), asserting the counters across pause and
suspend and that the suspend recorded plain Data content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant