Teams: scope data per team, per-team integration keys, per-team dead-man switches #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #1. Depends on Postgres and the admin role. This is the core of the multi-tenancy work.
Today
There is no team, org or tenant concept.
alerts,incidents,schedule_entriesandapi_keysare global, and ingest comes through a single unauthenticatedPOST /api/alertmanager/webhook(internal/api/alertmanager.go).Scope
Model
teamsandteam_members(user, team, roleowner|member).team_idonincidents,alerts,schedule_entries,integrations, and the notification outbox as needed.Ingestion
integrationstable: team, kind (alertmanagerto start), name, key hash, created/last-used.POST /api/integrations/{key}/alertmanagerreplaces the global webhook, and resolves the team from the key. This closes the unauthenticated-ingest gap.Scoping
internal/api/filters by the caller's team membership. The incident, alert, schedule and on-call queries inincident_store.goall need it.ownergates team config (escalation, schedules, integrations, fallback topic, dead-man, membership);membercovers incident work (ack, assign, snooze, resolve, note).Schedules
schedule_entriesto a team, and allow several schedules per team. Keep the one-person-per-UTC-day model; rotations are a separate issue.Dead-man switches
TERDUT_DEADMAN_MATCHERS/_TIMEOUT/_SEVERITYinto per-team rows. A heartbeat belongs to the team whose integration received it, and a missed one opens an incident there (internal/api/deadman.go,archiver.go).UI
internal/web/static/js/queue.js,incident.js,oncall.js).Done when
Two teams can coexist with no data leaking between them, an alert posted to a team's integration key opens an incident only in that team, and the existing install migrates into a default team with nothing lost.
Merged to
mainas of05f8222(#10, #11, #13), and the gate is green there:make fmt lint test helm-lintwith-raceagainst Postgres 17.One clause of "Done when" is not met yet, and cannot be from a merge:
Nothing is released or deployed. The running install is still on v0.11.1, which predates teams — migrations
002_admin_role,003_teamsand004_team_deadmanhave only ever run against test databases and a scratch one. Closing this by theCloses #4line is therefore accurate about the code and ahead of the deployment, the same way #2's auto-close was.Left to do, and worth tracking wherever it belongs rather than being assumed:
POST /api/alertmanager/webhookis what keeps delivery working, routed to the oldest team.TERDUT_DEADMAN_MATCHERSand friends stay in the chart: they seed the default team's switches on first start, after which the team owns them.