68 lines
2.9 KiB
YAML
68 lines
2.9 KiB
YAML
openapi: 3.2.0
|
|
info:
|
|
title: Lincodex Lab Provisioner API
|
|
version: 0.1.0
|
|
description: |-
|
|
Internal API of the lab provisioner `labd`. Only the Go backend calls it;
|
|
it is never exposed to browsers or to the public network. `labd` is the
|
|
only component that talks to the LXD API on the app host: the backend
|
|
never receives the LXD socket, an LXD certificate, or a node address.
|
|
|
|
Transport and authentication: `labd` listens on a private address of the
|
|
app host that only the backend network reaches and serves HTTPS (TLS
|
|
1.3). Every operation except the health routes requires `Authorization:
|
|
Bearer <token>`; the token is a shared random secret of at least 32
|
|
characters that comes from the deployment secret store, never from this
|
|
repository. A missing or wrong token answers 401 `unauthenticated`. Plain
|
|
HTTP exists only behind an explicit development switch.
|
|
|
|
Data minimization: a lab request carries only a template reference, a
|
|
variant seed, and a lifetime. It has no candidate, account, attempt,
|
|
task, or company identifier. The lab ID is a random UUID chosen by the
|
|
backend for idempotency. Responses never carry node addresses, MAC
|
|
addresses, bridge or instance names, keys, or passwords: the backend
|
|
reaches a node only through a console token and learns a lab's state
|
|
only through these operations.
|
|
|
|
Lifecycle: CreateLab reserves capacity and answers immediately with the
|
|
lab in `provisioning`; `labd` clones the nodes of the template from
|
|
prepared snapshots, connects them with per-lab L2-only bridges, boots
|
|
them, and waits until their management ports answer. The caller polls
|
|
GetLab until `ready`. Every lab has a fixed `expires_at`; `labd` deletes
|
|
it at that time even after a restart of its own process, and DeleteLab
|
|
deletes it earlier. A deleted lab stays readable as `deleted` for a
|
|
bounded time, then answers 404.
|
|
|
|
Capacity: the number of concurrent labs follows the host memory budget of
|
|
`labd`. A request that does not fit answers 503 `lab_pool_busy` with
|
|
Retry-After and stores nothing; it is a capacity signal, not an
|
|
infrastructure failure. `labd` does not queue labs.
|
|
servers:
|
|
- url: /
|
|
security:
|
|
- bearerAuth: []
|
|
paths:
|
|
/healthz:
|
|
$ref: ./routes/healthz.yml
|
|
/readyz:
|
|
$ref: ./routes/readyz.yml
|
|
/v1/labs/{lab_id}:
|
|
$ref: ./routes/labs.yml
|
|
/v1/labs/{lab_id}/console-tokens:
|
|
$ref: ./routes/lab_console_tokens.yml
|
|
/v1/labs/{lab_id}/check:
|
|
$ref: ./routes/lab_check.yml
|
|
components:
|
|
securitySchemes:
|
|
bearerAuth:
|
|
type: http
|
|
scheme: bearer
|
|
description: >-
|
|
Shared random service token sent as `Authorization: Bearer <token>`
|
|
over TLS. `labd` compares it in constant time and never logs it.
|
|
Rotation replaces the secret on both sides; there are no per-user
|
|
tokens.
|
|
responses:
|
|
Problem:
|
|
$ref: ./components/responses.yml#/Problem
|