Chaos Drills — Reference¶
Scheduled failover fire drills (Solo #608). For the how-to, see
Chaos Drills. Pro tier (FeatureChaosDrills).
Objects¶
ChaosDrill¶
| Field | Type | Notes |
|---|---|---|
id |
string | |
name |
string | Required. |
poolId |
string | Required. Must exist in the tenant. |
weekdays |
int[] | 0=Sunday … 6=Saturday. Empty = every day. |
timeOfDay |
string | HH:MM, UTC. Required. |
minHealthy |
int | Skip if fewer healthy members would remain. Default 1. |
nextRunAt |
int | Unix seconds. |
lastRunAt |
int | Unix seconds of the last scheduled claim; a manual run does not move it. |
ChaosDrillRun (report)¶
| Field | Notes |
|---|---|
status |
running, passed, failed, skipped, error. |
trigger |
schedule or manual. |
memberId, memberName |
The member failed. Empty on a run skipped before touching anything. |
reason |
Why a run was skipped, failed, or errored. |
checks[] |
One per service on the pool: serviceId, domain, clientIp, selected[], pass, note. |
startedAt, finishedAt |
Unix seconds. |
restoreDueAt |
Deadline after which any node's sweep restores the member. Set to start + 120 s. |
restoredAt |
Unix seconds the member was re-enabled. Absent until it has been. |
Reports are kept per drill, newest 100.
Endpoints¶
| Method | Path | Permission | Notes |
|---|---|---|---|
| GET | /api/v1/drills |
drill:read |
|
| POST | /api/v1/drills |
drill:write |
400 on a bad schedule, 403 without a pro license, 404 for an unknown pool. |
| DELETE | /api/v1/drills/{id} |
drill:write |
Cascades to reports. |
| POST | /api/v1/drills/{id}/run |
drill:write |
Returns the finished report. A failed or skipped drill is still HTTP 200. 503 if the controller is not running on this node. |
| GET | /api/v1/drills/{id}/runs?limit=N |
drill:read |
Newest first; default 20, max 100. |
drill:read is granted to viewers and above; drill:write to operators and above.
Storage¶
Two tables, chaos_drills and chaos_drill_runs; runs cascade from drills and
drills cascade from pools. A run row is inserted before the member is
disabled — that ordering is what makes restore crash-safe.
Controller (internal/drill)¶
Runs on every node with no leader election.
- Tick: 30 s.
- A due drill is claimed with
UPDATE … SET next_run_at=? WHERE id=? AND next_run_at=?; the node that wins runs it. - Member selection: enabled and healthy members sorted by ID, the first one
after the member failed last time, wrapping. Health is the cluster-level
health_statusaggregate; a member with no probe row counts as healthy, matchinghealth.Manager.IsHealthy. - Verification uses the DNS server's
SimulateResolutionfor each service whosepoolIdis the drill's pool, from client192.0.2.1. It passes only if the failed member's address is absent from the selected set and the set is not empty.
Terraform¶
nexus_drill — fire-and-forget (every input forces replacement).
resource "nexus_drill" "weekly_web" {
name = "weekly-web-failover"
pool_id = nexus_pool.web.id
weekdays = [2] # Tuesday; omit for every day
time_of_day = "03:00" # UTC
min_healthy = 2
}
Kubernetes¶
Not applicable: chaos drills do not integrate with the Kubernetes API.