Documentation
¶
Overview ¶
Package podspec builds a sandboxed corev1.Pod from a SpiceboxSession + resolved SpiceboxClass spec.
Index ¶
- Constants
- func Build(s *spiceboxv1alpha1.SpiceboxSession, class spiceboxv1alpha1.SpiceboxClassSpec) (*corev1.Pod, error)
- func BuildClassSpec(class spiceboxv1alpha1.SpiceboxClassSpec, ...) (corev1.PodSpec, error)
- func BuildSnapshotStorePVC(sess *spiceboxv1alpha1.AgentSession, storageClass, size string) *corev1.PersistentVolumeClaim
- func HardenedContainerSecurityContext() *corev1.SecurityContext
- func HardenedPodSecurityContext() *corev1.PodSecurityContext
- func PodNameFor(s *spiceboxv1alpha1.SpiceboxSession) string
- func SnapshotStoreClaimName(sess *spiceboxv1alpha1.AgentSession) string
- func WorkspaceClaimName(sess *spiceboxv1alpha1.AgentSession) string
Constants ¶
const ( // ContainerName is the name of the sandbox container in every pod this // package builds. Exported because the pod sandbox kind binds its exec // transport to this container. ContainerName = "sandbox" // SkillsMountPath is where staged skill bundles land in the sandbox: each // bundle unpacks to /skills/<LocalName>/ — the skill's own AgentSkill name, // which is what a disk-based consumer (Claude Code) looks for because it // must match the staged SKILL.md's frontmatter name (see // ResolvedSkillBundle.LocalName and BuildBundleSession in // pkg/controllers/agentsession/bundles.go). NOT <MountName>: that value is // only the Kubernetes-object-safe volume/ConfigMap name and is never the // sandbox-visible directory. // // Exported (rather than the package-private form the rest of this file's // constants use) so that internal/cmd/claudeshim/main.go — which needs the // same path to link staged skills into Claude Code's discovery path, and // today hand-duplicates the "/skills" literal under its own constant of // the same name — can import this one instead of re-typing the value. // Not wired up in this change: internal/cmd/claudeshim/ is out of scope // pending a separate architecture decision on the claudeshim/ // toolchain-claude split. SkillsMountPath = "/skills" )
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(s *spiceboxv1alpha1.SpiceboxSession, class spiceboxv1alpha1.SpiceboxClassSpec) (*corev1.Pod, error)
Build returns a Pod that implements the sandbox for the given Session. Returns an error if the class spec is missing fields the Pod requires.
func BuildClassSpec ¶
func BuildClassSpec(class spiceboxv1alpha1.SpiceboxClassSpec, toolchains []spiceboxv1alpha1.ToolchainMount) (corev1.PodSpec, error)
BuildClassSpec renders the class-derived PodSpec: everything that does not depend on a particular session. This is exactly the shape a pre-warmed sandbox has, and comparing a session's PodSpec against it is how the agent-sandbox backend decides whether that session may adopt one.
toolchains is the already-RESOLVED mount list (see pkg/tools/toolchain/resolve), not class.Toolchains itself. Resolution is a pure function of the class, so a pool builder and a session reach this function with the same mounts for the same class and get byte-identical output — that equality IS the adoption test. Pass nil only for a class with no toolchains: passing nil for a class whose Toolchains is non-empty renders a spec missing the overlay, which no session that resolved those toolchains can ever compare equal to, so that pool entry becomes unadoptable.
func BuildSnapshotStorePVC ¶
func BuildSnapshotStorePVC(sess *spiceboxv1alpha1.AgentSession, storageClass, size string) *corev1.PersistentVolumeClaim
BuildSnapshotStorePVC constructs the PVC the cp-by-pod Snapshotter writes snapshot subdirectories into. Owner-ref'd to the AgentSession so K8s GC deletes it when the session is deleted (same lifecycle as the workspace PVC).
ReadWriteOnce, matching the workspace PVC: under the bundled nodePathMap provisioner each PV carries nodeAffinity, and the snapshot/restore copy jobs mount workspace + snapstore in one pod — the shared nodeAffinity co-locates that pod and both PVCs on one node, where RWO permits the concurrent mounts.
func HardenedContainerSecurityContext ¶
func HardenedContainerSecurityContext() *corev1.SecurityContext
HardenedContainerSecurityContext returns the container-level security context applied to both the sandbox container and the runner container.
func HardenedPodSecurityContext ¶
func HardenedPodSecurityContext() *corev1.PodSecurityContext
HardenedPodSecurityContext returns the pod-level security context applied to both the sandbox pod (Build) and the runner pod (BuildRunnerPod). Callers that need the service-account token (e.g. the runner) must leave AutomountServiceAccountToken at its default (nil / true); the sandbox pod sets it to false separately.
func PodNameFor ¶
func PodNameFor(s *spiceboxv1alpha1.SpiceboxSession) string
PodNameFor returns the deterministic Pod name for a given SpiceboxSession.
func SnapshotStoreClaimName ¶
func SnapshotStoreClaimName(sess *spiceboxv1alpha1.AgentSession) string
SnapshotStoreClaimName is the deterministic name of the snapshot-store PVC paired with an AgentSession's workspace PVC. The snapshot store accumulates one subdirectory per JIT snapshot taken by the cp-by-pod Snapshotter.
func WorkspaceClaimName ¶
func WorkspaceClaimName(sess *spiceboxv1alpha1.AgentSession) string
WorkspaceClaimName is the deterministic name of the PVC backing an AgentSession's shared workspace (ReadWriteOnce; see BuildWorkspacePVC).
Types ¶
This section is empty.