Skip to content

[Feature Request] Expose the snapshot's restore image reference in the Snapshot API (cross-server / cross-runtime restore) #994

@ferponse

Description

@ferponse

Summary

The Snapshot REST response (POST /sandboxes/{id}/snapshots, GET /snapshots/{id}, GET /snapshots) does not include the resulting OCI image reference. The server already computes and stores it internally (SnapshotRecord.restore_config.image) but only uses it to resolve same-server snapshotId restores. We'd like it exposed in the API so a client can restore a snapshot on a different server / runtime via image.

Use case

We're building an internal developer-sandbox platform (~800 engineers) where a sandbox can run on a local Docker-runtime server (laptop) or a cloud Kubernetes server (batchsandbox provider), and we want to move a running sandbox between them in both directions, transporting state as an OCI image through a shared registry:

  • local → cloud works: the docker snapshot image ref is deterministic (opensandbox-snapshots:<id>), so we tag + push it and create the cloud sandbox from that image.
  • cloud → local is blocked: the commit Job pushes the snapshot image to the configured registry and records the ref in SandboxSnapshot.status.containers[].imageUri (→ the server's restore_config.image), but the server API never returns it. And snapshotId restore only works on the same server (per-server snapshot store), so a cross-server restore must use the image ref — which we can't obtain via the API.

Our only current options are (a) read the SandboxSnapshot CR directly via the k8s API (couples the client to provider/CR internals), or (b) derive the ref by naming convention (fragile). Both are workarounds for a value the server already holds.

Proposal

Add the restore image reference to the Snapshot schema (e.g. imageUri / restoreImage), populated once the snapshot is Ready from restore_config.image:

  • docker runtime → opensandbox-snapshots:<id> (or its pushed registry ref),
  • kubernetes runtime → the status.containers[].imageUri pushed by the commit Job.

Optionally per-container refs and/or an explicit "exported to registry" indicator.

References

Happy to send a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions