Kubernetes preview and simulation tool
StuntDouble
Run both versions. Give each one its own state.
Say a change passes its unit tests and you still want to see what it does once the application, worker, and database are all running. StuntDouble starts that deployment for you. Keep the old version handy, give both versions the same input, and see what actually changed.
See where the two versions differ
Same seed and checks
The caller supplies both.
Pinned baseline
The saved deployment and images.
Candidate
Its own endpoint and run data.
Run the checks against each endpoint. Keep the results and logs after both previews stop.
For people reviewing changes
Try a worktree, an exact Git revision, or an existing deployment bundle in a disposable environment.
Built to run on its own
The standalone CLI and weather fixture came first. A Dev Barracks evaluation worker became one consumer.
What’s been exercised
Side-by-side runs, replay after cluster recreation, and sustained preview rotation on a locally measured fixture.
In this case study
Put the working version next to the change
Imagine you’re reviewing a change to a worker that writes temperature readings. You want to know whether a reading still reaches the database and whether the new code handles it differently. With two running versions you can send each the same reading, look at the response and logs, and check what actually landed.
A developer can try the files in their worktree without creating a commit. A reviewer can ask for one exact revision and keep the baseline around for the next review. A tool can submit a prepared bundle and drive the same workflow from a job. All three get back a run ID they can inspect, an endpoint while it’s ready, and retained logs when it’s gone.
Try the working copy
Keep your local edits. Give the preview a name and run the deployment recipe the repository already carries.
Come back to the same version
Pin the rendered bundle and exact images. Reopen that baseline even after its source branch has moved.
Show what happened
Keep the request, response, and logs together so the next person can see what the comparison actually checked.
Distill’s weather example was the first full-stack fixture. A tagged reading had to go through the app and broker and show up in PostgreSQL. A separate small HTTP fixture proved the ordinary preview path with no broker or database. That gave the tool a demanding first workload and an independent check that the interfaces stayed general.
From source files to a run you can inspect
Preparation ends at a deployment bundle. The worker can pick it up later with everything it needs to start the Kubernetes side. That handoff is what makes the CLI useful on its own and gives another application a clean place to plug in.
Selected inputs
A worktree, Git commit, source directory, or versioned images.
Prepared bundle
Rendered Helm manifests, image references, and an endpoint contract.
Durable run
Status, loopback endpoint, logs, and ownership for teardown.
Freeze the inputs before Kubernetes starts
With a working directory, Bundles copies the current files before building. Pass --ref and it resolves the commit and exports that tree without switching your checkout. A recipe maps each Dockerfile context or prebuilt image to a Helm value. It also names the service and port for the preview, the readiness path, and any managed dependencies. The rendered manifests and versioned metadata travel together. A preparation failure reaches the caller before a run exists.
Bundles owns snapshotting, image preparation, rendering, and pins. Runs owns acceptance, the worker, status, forwarding, and teardown. Simulations owns the version-and-seed matrix, probes, and reports. Each module exposes Public contracts. Application code drives those contracts, Infrastructure connects the tools and stores, and the CLI composes the providers. Build-time reference checks keep cross-module calls on the Public surface.
The run ID outlives your terminal
Submission validates and saves the run as Accepted before it starts Kubernetes work. The worker applies the workloads in a run-owned namespace, forwards the configured service to loopback, and waits for an HTTP 2xx on the readiness path. Put dependency checks on that path if you want readiness to include them. A passing readiness probe gives the caller a working endpoint. The caller still decides whether the application behaved correctly.
Accepted
A run ID and the prepared input are on disk.
Ready
The configured endpoint answers on the worker host.
Stopping
The worker is still releasing resources.
Stopped
The preview is gone. Its record and captured logs are available.
When a submit response disappears, repeat the saved bundle with the same scope and submission key. The worker state resolves it to the original run, even after teardown. Changing the bundle under that key returns a conflict. A later intentional attempt gets a new key. Keep the run records and submission namespace together when restoring state. After a worker restart, read status again because the loopback port can change.
Keep the servers warm and the data separate
Starting PostgreSQL and RabbitMQ for every short check costs time. In the shared configuration, their servers stay running while each preview gets its own database and role, plus a RabbitMQ virtual host and login. The worker supplies the connection settings for the run. Removing one preview leaves the shared servers and other previews in place. Recipes that bring their own dependencies can keep those dependencies inside the preview instead.
| Resource | Shared when configured | Owned by each run |
|---|---|---|
Kubernetes | Cluster and worker | Namespace, workloads, and loopback forwarding |
PostgreSQL | Server | Database and role |
RabbitMQ | Broker | Virtual host and login |
An app can fail to start while the worker is still cleaning up its database or virtual host. The run exposes the failure and the pending cleanup separately. Keep that preview’s slot until teardown reaches Stopped. In the two-slot test, one preview kept rotating while cleanup in the other slot was held up. Repeated stop requests and successful cleanup were part of the check.
Replay a version, then compare the same case
Pin and compare
A pin keeps the rendered bundle, the actual workload image archive, and its checksum. Replay verifies the archive and opens a fresh run with fresh data. Because it uses archived images, the baseline can still run after its branch moves or a compatible kind cluster is recreated.
./stuntdouble compare stable --candidate candidate
./stuntdouble compare-status BASELINE_RUN --candidate CANDIDATE_RUN --wait
Use the returned run IDs in the second command. Open the two ready endpoints side by side.
Run a batch
A simulation plan names a baseline, candidates, seeds, and ordered HTTP checks. StuntDouble prepares each source version once and uses a fresh preview for every version-and-seed pair. It compares the candidate to the baseline for the same seed and writes Markdown and JSON reports, per-case logs, and a progress journal.
./stuntdouble simulate examples/simulation/batch.json --output "$work/http-comparison"
With the worker running, point $work at your on-disk working directory and use a fresh output folder.
Rerun one result
Keep the original report and pins. The rerun reads the recorded archive and seed and produces a fresh report for that case. If a batch ends abruptly, the progress journal preserves submitted IDs so you can inspect and stop remaining previews.
./stuntdouble simulate-rerun "$work/http-comparison/report.json" \
--case multi-image/second --output "$work/http-rerun"
Measure a whole rotation
The benchmark counts a preview after its checks and confirmed teardown. It builds a distinct image per case and verifies the expected version, PostgreSQL scope, and RabbitMQ scope. Splitting build capacity from active-preview capacity lets the next image prepare while the current one runs. A bounded buffer keeps that overlap from filling the disk or queue unchecked.
100 in 17 min 38 s
Initial two-slot external CLI fixture, with shared dependencies and cleanup checked.
1,509 per hour
Average across 500 verified previews in the registry-backed fixture.
1,224 per hour
Average across 1,000 verified previews. The tier took 49 minutes and released every run allocation.
The registry-backed numbers came from one Linux kind node with rootless Podman and a small fixture. Publishing digest-pinned images let the node pull them and reuse available layers. A real adopter can compare image build, pull, readiness, checks, and cleanup on its own application and runtime before choosing capacity.
Prove the reviewer’s job end to end
The standalone tool is useful today. The next test is whether a team can keep getting evidence it trusts when reviews queue up, a worker restarts, or cleanup takes longer than expected.
Pick up a batch after an interruption
Write completed case evidence as it arrives. Keep the prepared bundle and submission key before accepting each preview. On restart, reconcile the accepted runs and continue the cases that still need work.
Spend time on active work
Keep full history for inspection and focus worker polling on runs that can still start, retry, or clean up. Measure how much image transfer and teardown contribute as the retained history grows.
Dev Barracks used a pinned CLI in an opt-in trusted post-merge pilot. The host picked the exact commits, supplied the recipe and checks, kept the evidence, and owned the reviewer’s access to it. StuntDouble owned the previews and cleanup. The existing Workshop Run and automated main-build paths continued to serve their own purposes. The trusted pilot gives the integration a place to test recovery and startup or check failures against real review work.
