Skip to content

feat(cloud): make the control plane the record of its cloud nodes - #286

Draft
outofcoffee wants to merge 5 commits into
mainfrom
plane-owns-cloud-environments
Draft

outofcoffee wants to merge 5 commits into
mainfrom
plane-owns-cloud-environments

Conversation

@outofcoffee

@outofcoffee outofcoffee commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Cloud nodes were registered per machine under ~/.config/spinloop/clouds/, so a colleague's deployment was invisible and every box needed its own files. The AWS control plane is now the record: cloud nodes resolve from credentials and region alone, and nothing about them touches disk. The word "environment" retires — a cloud node is a node, the way the fleet file always said.

Closes #276

Summary

  • Plane resolution (internal/cloud): a control plane resolves from the caller's own credentials and region — the well-known stack there names its endpoints — memoised per process and revalidated once when a call reports the plane has moved. A complete-enough SPINLOOP_CLOUD_* set states a plane outright with no stack read, which is how CI drives one.
  • Registry deleted: environments.go is gone; cloud.json is never read or written; no default and no file-stated ENV selects a target. --node is required everywhere, including deploy — an assumed name on a shared plane could act on someone else's instance.
  • Inventory: cloud ls reads the plane's own record — every cloud node, with who deployed it, when, what it serves and where it answers. The control plane stamps deployedBy/deployedAt from the invoking principal at deploy, and an env-less stats read answers the inventory as {"nodes":[{"node":…}]}.
  • spinloop cloud undeploy: takes one explicitly named node apart — instance, Elastic IP, security group, key secret, schedules, deploy config — with --dry-run and explicit consent that names the deployer first.
  • Fleet and gateway: kind: cloud nodes and the gateway's candidate check resolve through the same plane (with a short-lived inventory cache); the fleet file stays the membership allow-list, byte-identical in schema.
  • Deploy guard: a redeploy over a node the plane already has, or one that is running, now needs --allowed-cidr beside --overwrite, since ingress on a shared node is everybody's business.
  • Terminology: user-facing copy, Go identifiers and the new unreleased wire keys say node; already-deployed shapes keep their word (env= query parameter, stats replies' environment field, SSM paths) — nothing running is renamed under the CLI's feet.

Implementation details

  • Plane identity is (credentials, region); named planes are deliberately not supported — the stack name is well-known so there is nothing to coordinate per team.
  • A plane that predates the inventory answers the env-less read the way it always did; the CLI reports "does not report its nodes — re-bootstrap" rather than a confidently empty list.
  • requiredEndpointVars is START+STOP only: a specified plane can cover lifecycle verbs without a schedule endpoint, which is how the old-plane schedule test simulates a pre-bootstrap plane.
  • Undeploy routes through the same call path as every lifecycle verb, so a stale plane re-resolves once before the request is counted as failed; existence is checked against the inventory before consent is asked.
  • Tests stub the plane with documented-reservation addresses behind a reverse proxy, keeping scripts/check-no-cloud-identifiers.sh green; the remote-cli IAM policy is asserted unchanged by a stack test.
  • The openspec change (plane-owns-cloud-nodes) carries the terminology rename in RENAMED spec sections; scenario titles inside MODIFIED blocks match the current specs byte-exact and are reworded at archive.

Behaviour change to flag: cloud ls and any --node command now require resolvable credentials and a reachable plane, and region resolution fails rather than defaulting to us-east-1.

The stats endpoint answers an env-less read with the plane's full
inventory: every deployed environment with who deployed it, when, what
it serves and where it answers. Deploy stamps deployedBy and deployedAt
from the invoking principal; an unknown principal or region still
deploys. Stop gains action=undeploy, which takes one named environment
apart — instance, address, security group, key secret, schedules and
deploy config — refusing the undeployed, honouring dryRun, and leaving
siblings and shared resources untouched. The new reads and writes ride
the inventory and deploy Lambdas' own roles; the remote-cli policy
grants nothing new.
Cloud environments are shared, so they belong to the control plane and
not to one machine's ~/.config/spinloop/clouds/. A plane resolves from
the caller's own credentials and region — the well-known stack there
names its endpoints — memoised per process and revalidated once when a
call says the plane has moved; a complete-enough SPINLOOP_CLOUD_* set
states a plane outright with no stack read. The per-user registry is
gone: environments.go is deleted, cloud.json is never read or written,
and no default or file-stated ENV selects an environment — --node is
required everywhere, including deploy, so an assumed name can never act
on a colleague's instance. cloud ls reads the plane's inventory; the new
cloud undeploy takes one explicitly named environment apart, asking for
consent (naming its deployer first) and offering --dry-run. Fleet cloud
nodes and the gateway's candidate check resolve through the same plane,
with a short-lived inventory cache behind them; the fleet file remains
the membership allow-list. A redeploy over an existing environment now
needs --allowed-cidr beside --overwrite, since the plane is shared.
Every page that spoke of a per-machine environment registry now says the
plane is the record: cloud ls reads it, --node names an environment on
it, a committed fleet file works for anyone with credentials, and
~/.config/spinloop/clouds/ is no longer read or written and may be
deleted. Adds the undeploy section, the release-note breaking change,
and ticks the change's implementation tasks.
The cloud thing a plane hosts is a node — the fleet file already calls
it that, and --node has always been the flag that names it — so
environment retires. User-facing copy, Go identifiers and the new,
still-unreleased wire keys say node: the inventory now answers
{"nodes":[{"node":…}]} and an undeploy replies {"node":…}. Already-
deployed shapes keep their word — the env= query parameter, the stats
replies' environment field, the SSM paths — nothing already running is
renamed under the CLI's feet. The change's spec deltas carry the rename
in RENAMED sections (requirement headers included); scenario titles
match byte-exact until archive, when they become the spec's own and are
reworded there.
@outofcoffee outofcoffee changed the title feat(cloud): make the control plane the record of its environments feat(cloud): make the control plane the record of its cloud nodes Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: registered cloud nodes are just nodes in a system fleet

1 participant