PRD: reprovision on gateway startup #517
Reference in New Issue
Block a user
Delete Branch "prd-gateway-reprovision-on-bringup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements PRD 0081 (reconcile running bottles against a freshly-booted gateway instead of persisting gateway state on volumes). Supersedes the abandoned persistent-volume PRs #511 / #513.
In this PR
docs/prds/0081-*.md— the design.OrchestratorCore.update_agent_secret+registry.store_agent_secret(per-key upsert) +POST /bottles/<id>/secret(cli-only) +client.update_agent_secret— update ONE egress token in place, the single-secret counterpart ofreprovision_from_secret's restore-all. This is the reusable primitive extracted from the 2026-07-26 hotfix; unit-tested across service/store/server/client.reconcile.py—attach_bottled_agents_to_gateway: on gateway cold boot, push the new mitmproxy CA into every live agent VM's trust store, re-provision git-gate repos/creds from the persistedupstreams.jsonsnapshot, and restore egress tokens. Per-bottle failures are logged and skipped.git_gate/provision.py— writesupstreams.jsonafter key provisioning so the reconcile can reconstruct upstream state without the manifest.FirecrackerInfraService.ensure_running()cold-boot path;BottleBackendbase gets a no-op default.Refs #516. Addresses the root problems in #510 and #512 (closed by the reconcile once it lands).
eb8ac7f011tof9d0e15f13@@ -0,0 +57,4 @@- The docker / macOS backends. This lands the reconcile for Firecracker (thebackend that boots a fresh gateway rootfs each time); docker keeps its existinghost-bind-mounted CA until the same seam is extended there (follow-up). Theunification target is *per-service*, not *per-backend*.No, target is for both. And it should be enforced on the base abc class for the backend/there should be something like a
attach_bottled_agents_to_gatewaymethod on the backend that reprovisions all the bottled agents.Re: the docker/macOS non-goal (review comment on
docs/prds/0081-...md) — agreed, made it target all backends, enforced on the ABC.Updated in
4434752d:attach_bottled_agents_to_gateway()as an@abc.abstractmethodonBottleBackend(backend/base.py). Reconciling running bottles is a backend responsibility (only the backend can enumerate its agents and reach them — firecracker over SSH, docker/macOS overexec/cp), so every backend must implement it — cross-backend by construction, no per-backend follow-up. It reprovisions all registered bottles' CA + git-gate + egress tokens.attach_bottled_agents_to_gatewaypushes the CA to running agents, itshost_gateway_ca_dirbind-mount is redundant — leaning toward dropping it so docker rotates like firecracker (one behaviour across backends).The firecracker specifics (hook install, per-agent CA push, git-gate re-init, token reprovision) are now written as that backend's implementation of the abstract method.
Yes, make it consistent across backends.
PRD 0081: reprovision gateway-dependent state on gateway bring-upto PRD: reprovision on gateway startup4434752db4tof565749f59f565749f59tocf6bbc43da6487f0087atodee0121e8d