Skip to content

Commit e856491

Browse files
authored
feat: enable PG Coordinator as experiment (#8144)
Signed-off-by: Spike Curtis <spike@coder.com>
1 parent e738123 commit e856491

File tree

6 files changed

+34
-11
lines changed

6 files changed

+34
-11
lines changed

coderd/apidoc/docs.go

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

+6-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codersdk/deployment.go

+4
Original file line numberDiff line numberDiff line change
@@ -1729,6 +1729,10 @@ const (
17291729
// https://github.com/coder/coder/milestone/19
17301730
ExperimentWorkspaceActions Experiment = "workspace_actions"
17311731

1732+
// ExperimentTailnetPGCoordinator enables the PGCoord in favor of the pubsub-
1733+
// only Coordinator
1734+
ExperimentTailnetPGCoordinator Experiment = "tailnet_pg_coordinator"
1735+
17321736
// Add new experiments here!
17331737
// ExperimentExample Experiment = "example"
17341738
)

docs/api/schemas.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -2495,10 +2495,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
24952495

24962496
#### Enumerated Values
24972497

2498-
| Value |
2499-
| ------------------- |
2500-
| `moons` |
2501-
| `workspace_actions` |
2498+
| Value |
2499+
| ------------------------ |
2500+
| `moons` |
2501+
| `workspace_actions` |
2502+
| `tailnet_pg_coordinator` |
25022503

25032504
## codersdk.Feature
25042505

enterprise/coderd/coderd.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,12 @@ func (api *API) updateEntitlements(ctx context.Context) error {
414414
if changed, enabled := featureChanged(codersdk.FeatureHighAvailability); changed {
415415
coordinator := agpltailnet.NewCoordinator(api.Logger)
416416
if enabled {
417-
haCoordinator, err := tailnet.NewCoordinator(api.Logger, api.Pubsub)
417+
var haCoordinator agpltailnet.Coordinator
418+
if api.AGPL.Experiments.Enabled(codersdk.ExperimentTailnetPGCoordinator) {
419+
haCoordinator, err = tailnet.NewPGCoord(ctx, api.Logger, api.Pubsub, api.Database)
420+
} else {
421+
haCoordinator, err = tailnet.NewCoordinator(api.Logger, api.Pubsub)
422+
}
418423
if err != nil {
419424
api.Logger.Error(ctx, "unable to set up high availability coordinator", slog.Error(err))
420425
// If we try to setup the HA coordinator and it fails, nothing

site/src/api/typesGenerated.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -1346,8 +1346,15 @@ export const Entitlements: Entitlement[] = [
13461346
]
13471347

13481348
// From codersdk/deployment.go
1349-
export type Experiment = "moons" | "workspace_actions"
1350-
export const Experiments: Experiment[] = ["moons", "workspace_actions"]
1349+
export type Experiment =
1350+
| "moons"
1351+
| "tailnet_pg_coordinator"
1352+
| "workspace_actions"
1353+
export const Experiments: Experiment[] = [
1354+
"moons",
1355+
"tailnet_pg_coordinator",
1356+
"workspace_actions",
1357+
]
13511358

13521359
// From codersdk/deployment.go
13531360
export type FeatureName =

0 commit comments

Comments
 (0)