Repository navigation
feat(cloud): make the control plane the record of its cloud nodes - #286
Draft
outofcoffee wants to merge 5 commits into
Draft
outofcoffee wants to merge 5 commits into
outofcoffee wants to merge 5 commits into
Conversation
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.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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-enoughSPINLOOP_CLOUD_*set states a plane outright with no stack read, which is how CI drives one.environments.gois gone;cloud.jsonis never read or written; nodefaultand no file-statedENVselects a target.--nodeis required everywhere, includingdeploy— an assumed name on a shared plane could act on someone else's instance.cloud lsreads the plane's own record — every cloud node, with who deployed it, when, what it serves and where it answers. The control plane stampsdeployedBy/deployedAtfrom 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-runand explicit consent that names the deployer first.kind: cloudnodes 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.--allowed-cidrbeside--overwrite, since ingress on a shared node is everybody's business.env=query parameter, stats replies'environmentfield, SSM paths) — nothing running is renamed under the CLI's feet.Implementation details
requiredEndpointVarsis 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.callpath 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.scripts/check-no-cloud-identifiers.shgreen; the remote-cli IAM policy is asserted unchanged by a stack test.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 lsand any--nodecommand now require resolvable credentials and a reachable plane, and region resolution fails rather than defaulting tous-east-1.