Skip to content

Controller: store, certificate authority and Join - #1

Merged
KristiforMilchev merged 1 commit into
mainfrom
controller-join
Nov 3, 2026
Merged

KristiforMilchev merged 1 commit into
mainfrom
controller-join

Conversation

@KristiforMilchev

Copy link
Copy Markdown
Contributor

First part of milestone M1 (see docs/ROADMAP.md): a build machine can now join the controller.

  • Store: PostgreSQL with embedded migrations, applied under an advisory lock so concurrent starts are safe; sqlc queries for workers and join tokens.
  • Certificate authority: built-in CA that issues worker client certificates and the controller's server certificate.
  • Join: controller token create -pool trusted prints a single-use token and the CA fingerprint. Join consumes the token, records the worker and signs its CSR in one transaction. The pool comes from the admin's token, never from the worker.
  • First contact: worker.PinnedCAConfig lets a worker verify the controller against the pinned CA fingerprint before it has the CA bundle.
  • Tests: database tests run against PostgreSQL in CI and fail rather than skip when no database is available. They cover single-use tokens, ten machines racing for one token, rejected requests not burning the token, and a full token-create → TLS → Join run through the binary.

Not yet: the Connect stream, requiring mTLS on it, and certificate renewal.

🤖 Generated with Claude Code

- internal/controller/store: PostgreSQL with embedded migrations (applied
  under an advisory lock) and sqlc queries for workers and join tokens
- internal/controller/ca: built-in CA for worker client certificates and the
  controller's server certificate
- internal/controller/workers: single-use join tokens (only a hash is
  stored) and Join, which consumes the token, records the worker and signs
  its CSR in one transaction; the pool comes from the token, never the worker
- pkg/worker: PinnedCAConfig, so a joining worker verifies the controller
  against the CA fingerprint printed with the token
- controller serve (TLS) and controller token create
- pgtest: per-test databases; CI runs them against PostgreSQL and fails
  instead of skipping when no database is available
- docs/ROADMAP.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KristiforMilchev
KristiforMilchev merged commit b389765 into main Nov 3, 2026
1 check passed
@KristiforMilchev
KristiforMilchev deleted the controller-join branch November 3, 2026 12:10
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