Skip to content

feat(pool): a pool grows by nodes a provisioner makes (ADR-0051) - #335

Merged
7schmiede merged 1 commit into
mainfrom
feat/adr-0051-provisioned-nodes
Oct 27, 2026
Merged

7schmiede merged 1 commit into
mainfrom
feat/adr-0051-provisioned-nodes

Conversation

@7schmiede

Copy link
Copy Markdown
Member

Builds ADR-0051, accepted on its card #328, with a mock provisioner to test it.

What it does

  • A lane placed by the pool (--on pool) that no node can take makes a machine through the pool's provisioner (devstack node serve --provisioner <url>). Only for members an admin allowed (devstack node members provision <id> on), never for warm leases or named nodes, and within caps (devstack node provisioning --max-nodes/--max-cpus/--max-memory-gib). A machine already on its way that holds the lane is waited for instead of making another.
  • The start waits as a phase of its own, provision, between 60 s and 10 min. The requester opts in with POST /v1/leases?wait=provision and polls GET /v1/leases/{id}/wait. An older requester is refused as before.
  • Enrolment: devstack join <coord> --fingerprint <fp> --enrol <token>. The token is single-use and accepted only from the IP the provisioner named. A second use, or one from another address, revokes the node, deletes the machine, and records an alarm for admins (machines list, dashboard, audit log when a node had enrolled).
  • --confirm admin makes each machine wait for devstack node confirm (or the dashboard). --per repo binds a machine to its repository through the node's policy.
  • Placement fills provisioned nodes: the members' own first, then the fullest provisioned one that fits.
  • Giving back: an idle machine (--idle-minutes, default 30) is revoked and deleted. Deletions are retried until confirmed, and the machine stays listed with the error until then. Events node_ready, lease_begun, lease_ended, node_returned go to the provisioner.
  • devstack pool provisioned off keeps a member's lanes off provisioned nodes. A lane on one says so when it starts.
  • Dashboard: provisioned nodes (machine, address, size, since, idle time left, unconfirmed with key), Confirm and Give back, a provisioning section with machines and alarms, an admin "may provision" switch, and the member's own switch.

Mocks for testing

  • devstack_node::provision::mock::Mock: an in-process provisioner. It can refuse, fail deletions, name another address or require a token, and records requests, deletions and events. crates/devstack-node/tests/provision.rs uses it end to end: wait → enrol → offer → fill → events → idle → give back with a failed deletion retried, refusals and caps, alarm on a second use, alarm on a foreign address, admin confirmation with repo binding.
  • devstack node mock-provisioner (hidden): the same mock as a process, to try it on one machine. --exec runs a command per machine with the enrolment in its environment; --refuse, --fail-deletes, --address and --token cover the other cases. See pool.md.
  • The dashboard's mock mode shows a confirmed node, an unconfirmed node and a machine with an alarm.

Decided by the agent

These are details within the approved card; the implementation follows from the points, but none was asked separately.

  • Protocol: no PROTOCOL bump. The offer keeps its shape, and waiting is opted into with ?wait=provision.
  • Repo binding: done through the node's policy repos, so node.rs is unchanged.
  • Provisioner auth: bearer token only (DEVSTACK_PROVISIONER_TOKEN or provisioner.token); no mTLS towards the provisioner yet.
  • Not built: pruning one stopped lane's slot after the idle time while other lanes still run on the machine. The machine as a whole goes once it has no lease. This is noted under the ADR's Paths as built.
  • Windows stack: crates/devstack/build.rs gives devstack.exe an 8 MiB main stack on Windows. The debug build's clap tree overflowed the default 1 MiB after the new subcommands; release builds were not affected.
  • Event delivery: an event the provisioner does not take is logged, not sent again.

Checks

cargo fmt --check, cargo clippy --workspace --all-targets (0 warnings) and cargo test --workspace are green on Windows. In ui/, npm run typecheck, npm test and npm run build are green.

🤖 Generated with Claude Code

A lane the pool places that no node can take makes a machine through the
pool's provisioner (an HTTP service that holds the provider's
credentials), for a member an admin allowed and within the pool's caps.
The start waits for it as a phase of its own; the machine enrols once
with a single-use token from the address the provisioner named, a second
use or one from elsewhere revokes it and alarms the admins. Optionally an
admin confirms each machine, or a machine runs one repository's lanes.
Placement fills provisioned nodes; idle ones are given back, deletions
retried until confirmed, and the provisioner is told of machines and
leases. A member can keep its lanes off them.

- devstack-node: provision.rs (contract, settings, machines, a mock
  provisioner), the coordinator's fallback, wait, enrolment, tend and
  rank_filling, the store's flags, Local::enrol/lease_or_wait/wait
- CLI: node serve --provisioner, node provisioning, node confirm, node
  give-back, node members provision, join --enrol, pool provisioned, the
  hidden node mock-provisioner
- daemon: the provision phase of a start on a node
- hub and dashboard: provisioned nodes, machines and alarms, confirm,
  give back, the member's own switch
- devstack.exe gets an 8 MiB main stack on Windows (build.rs): the debug
  build's clap tree overflowed the default 1 MiB

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit e5ca748 into main Oct 27, 2026
13 checks passed
@7schmiede
7schmiede deleted the feat/adr-0051-provisioned-nodes branch October 27, 2026 22:12
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.

1 participant