feat: enable PG Coordinator as experiment (#8144)

Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
Spike Curtis
2023-06-22 13:12:29 +04:00
committed by GitHub
parent e738123a9c
commit e856491476
6 changed files with 34 additions and 11 deletions
+4 -2
View File
@@ -7389,11 +7389,13 @@ const docTemplate = `{
"type": "string",
"enum": [
"moons",
"workspace_actions"
"workspace_actions",
"tailnet_pg_coordinator"
],
"x-enum-varnames": [
"ExperimentMoons",
"ExperimentWorkspaceActions"
"ExperimentWorkspaceActions",
"ExperimentTailnetPGCoordinator"
]
},
"codersdk.Feature": {
+6 -2
View File
@@ -6612,8 +6612,12 @@
},
"codersdk.Experiment": {
"type": "string",
"enum": ["moons", "workspace_actions"],
"x-enum-varnames": ["ExperimentMoons", "ExperimentWorkspaceActions"]
"enum": ["moons", "workspace_actions", "tailnet_pg_coordinator"],
"x-enum-varnames": [
"ExperimentMoons",
"ExperimentWorkspaceActions",
"ExperimentTailnetPGCoordinator"
]
},
"codersdk.Feature": {
"type": "object",
+4
View File
@@ -1729,6 +1729,10 @@ const (
// https://github.com/coder/coder/milestone/19
ExperimentWorkspaceActions Experiment = "workspace_actions"
// ExperimentTailnetPGCoordinator enables the PGCoord in favor of the pubsub-
// only Coordinator
ExperimentTailnetPGCoordinator Experiment = "tailnet_pg_coordinator"
// Add new experiments here!
// ExperimentExample Experiment = "example"
)
+5 -4
View File
@@ -2495,10 +2495,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
#### Enumerated Values
| Value |
| ------------------- |
| `moons` |
| `workspace_actions` |
| Value |
| ------------------------ |
| `moons` |
| `workspace_actions` |
| `tailnet_pg_coordinator` |
## codersdk.Feature
+6 -1
View File
@@ -414,7 +414,12 @@ func (api *API) updateEntitlements(ctx context.Context) error {
if changed, enabled := featureChanged(codersdk.FeatureHighAvailability); changed {
coordinator := agpltailnet.NewCoordinator(api.Logger)
if enabled {
haCoordinator, err := tailnet.NewCoordinator(api.Logger, api.Pubsub)
var haCoordinator agpltailnet.Coordinator
if api.AGPL.Experiments.Enabled(codersdk.ExperimentTailnetPGCoordinator) {
haCoordinator, err = tailnet.NewPGCoord(ctx, api.Logger, api.Pubsub, api.Database)
} else {
haCoordinator, err = tailnet.NewCoordinator(api.Logger, api.Pubsub)
}
if err != nil {
api.Logger.Error(ctx, "unable to set up high availability coordinator", slog.Error(err))
// If we try to setup the HA coordinator and it fails, nothing
+9 -2
View File
@@ -1346,8 +1346,15 @@ export const Entitlements: Entitlement[] = [
]
// From codersdk/deployment.go
export type Experiment = "moons" | "workspace_actions"
export const Experiments: Experiment[] = ["moons", "workspace_actions"]
export type Experiment =
| "moons"
| "tailnet_pg_coordinator"
| "workspace_actions"
export const Experiments: Experiment[] = [
"moons",
"tailnet_pg_coordinator",
"workspace_actions",
]
// From codersdk/deployment.go
export type FeatureName =