Persistence & Storage
By default a sandbox’s filesystem is ephemeral: everything in it is lost when
the sandbox is deleted. To keep data on block storage, mount a persistent
volume claim (PVC) with the volumes field of the create request.
Only pvc volumes are supported. Requests with host or ossfs volumes are
rejected.
Ephemeral sandboxes
Section titled “Ephemeral sandboxes”The default. No volumes needed:
{ "image": { "uri": "python:3.12-slim" }, "entrypoint": ["python3", "-m", "http.server", "8000"], "resourceLimits": { "cpu": "2", "memory": "2Gi" }, "extensions": { "nirvana.sandbox_cluster_id": "123e4567-e89b-12d3-a456-426614174000" }}Use these for stateless services, short tasks, and development and testing.
Sandboxes with a persistent volume
Section titled “Sandboxes with a persistent volume”{ "image": { "uri": "python:3.12-slim" }, "entrypoint": ["python3", "-m", "http.server", "8000"], "resourceLimits": { "cpu": "2", "memory": "2Gi" }, "volumes": [ { "name": "workspace", "pvc": { "claimName": "agent-workspace", "createIfNotExists": true, "storage": "50Gi" }, "mountPath": "/workspace" } ], "extensions": { "nirvana.sandbox_cluster_id": "123e4567-e89b-12d3-a456-426614174000" }}Volume fields
Section titled “Volume fields”name(required): name of the volume within the sandbox.mountPath(required): where the volume is mounted in the sandbox.readOnly: mount the volume read-only.subPath: mount a subdirectory of the volume.pvc.claimName(required): name of the PVC on the sandbox cluster.pvc.createIfNotExists: create the PVC if it doesn’t exist.pvc.storage: size of a PVC to create, such as"50Gi".pvc.storageClass: storage class of a PVC to create. Leave it out to use the cluster’s default.pvc.accessModes: access modes of a PVC to create.pvc.deleteOnSandboxTermination: delete the PVC when the sandbox is deleted.
PVCs live on the sandbox cluster. A PVC that isn’t deleted with its sandbox can
be mounted by a later sandbox on the same cluster with the same claimName,
so an agent can pick up from its last checkpoint. Deleting a sandbox cluster deletes
all of its PVCs and their data, and they can’t be recovered. Copy out anything
you need first.