-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: add gateway pools for high-availability failover #6050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bernie-g
wants to merge
26
commits into
main
Choose a base branch
from
feat/gateway-pools
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
e3714cc
feat: add gateway pools for high-availability failover
bernie-g 88a2821
chore: lint auto-format
bernie-g f0f81c4
fix: replace nested ternaries with if/else blocks
bernie-g edc64da
fix: org-scoping, race conditions, pool limit, query invalidation
bernie-g 25dca91
fix: add gatewayPool to license defaults and mock, remove pool limit
bernie-g 48d39d8
fix: slug validation, name uniqueness check, popover close on select
bernie-g c558d9f
docs: add gateway pools documentation with screenshots and FAQ
bernie-g 6eb9042
fix: add 15s refetch interval to gateway pools list
bernie-g e6b29e2
fix: replace nested ternary with if/else
bernie-g 7eb7f07
fix: address PR review feedback
bernie-g d4640f7
fix: use Promise.all pattern for connected resources count, fix neste…
bernie-g 7fd6b04
chore: lint auto-format pool modals
bernie-g 1266e73
Merge remote-tracking branch 'origin/main' into feat/gateway-pools
sheensantoscapadngan 086de07
fix: addressed v3 component rename
sheensantoscapadngan 8808a14
refactor: move gateway pools router from v2 to v1
bernie-g da4c131
chore: include pool and gateway names in pool membership audit logs
bernie-g 4082cec
refactor: let db enforce gateway pool delete restriction via fk
bernie-g 127399f
docs: drop feature-support FAQ from gateway pools docs
bernie-g d142ba1
docs: use 'gateway' instead of 'member' when referring to pool gateways
bernie-g 4939a32
chore: add pen icon to edit gateway pool dropdown item
bernie-g 981f4a6
feat: add gateway pools to org role permissions ui
bernie-g 200c721
docs: add gateway-pool to org permissions reference
bernie-g 94281de
chore: link gateway pools docs from networking tab badge
bernie-g d47e1d3
fix: prevent status badge clipping on long gateway names in picker
bernie-g 38abad1
fix: fail k8s auth update when pool has no healthy gateways
bernie-g 590b26b
Revert "fix: fail k8s auth update when pool has no healthy gateways"
bernie-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
backend/src/db/migrations/20260414000001_add-gateway-pools.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { Knex } from "knex"; | ||
|
|
||
| import { TableName } from "../schemas"; | ||
| import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils"; | ||
|
|
||
| export async function up(knex: Knex): Promise<void> { | ||
| // Create gateway_pools table | ||
| if (!(await knex.schema.hasTable(TableName.GatewayPool))) { | ||
| await knex.schema.createTable(TableName.GatewayPool, (t) => { | ||
| t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid()); | ||
| t.uuid("orgId").notNullable(); | ||
| t.foreign("orgId").references("id").inTable(TableName.Organization).onDelete("CASCADE"); | ||
| t.string("name", 32).notNullable(); | ||
| t.timestamps(true, true, true); | ||
| t.unique(["orgId", "name"]); | ||
| }); | ||
|
|
||
| await createOnUpdateTrigger(knex, TableName.GatewayPool); | ||
| } | ||
|
|
||
| // Create gateway_pool_memberships join table | ||
| if (!(await knex.schema.hasTable(TableName.GatewayPoolMembership))) { | ||
| await knex.schema.createTable(TableName.GatewayPoolMembership, (t) => { | ||
| t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid()); | ||
| t.uuid("gatewayPoolId").notNullable(); | ||
| t.foreign("gatewayPoolId").references("id").inTable(TableName.GatewayPool).onDelete("CASCADE"); | ||
| t.uuid("gatewayId").notNullable(); | ||
| t.foreign("gatewayId").references("id").inTable(TableName.GatewayV2).onDelete("CASCADE"); | ||
| t.timestamps(true, true, true); | ||
| t.unique(["gatewayPoolId", "gatewayId"]); | ||
| }); | ||
|
|
||
| await createOnUpdateTrigger(knex, TableName.GatewayPoolMembership); | ||
| } | ||
|
|
||
| // Add gatewayPoolId to identity_kubernetes_auths | ||
| const hasGatewayPoolId = await knex.schema.hasColumn(TableName.IdentityKubernetesAuth, "gatewayPoolId"); | ||
| if (!hasGatewayPoolId) { | ||
| await knex.schema.alterTable(TableName.IdentityKubernetesAuth, (t) => { | ||
| t.uuid("gatewayPoolId").nullable(); | ||
| t.foreign("gatewayPoolId").references("id").inTable(TableName.GatewayPool).onDelete("SET NULL"); | ||
| }); | ||
| } | ||
|
bernie-g marked this conversation as resolved.
|
||
| } | ||
|
|
||
| export async function down(knex: Knex): Promise<void> { | ||
| // Remove gatewayPoolId from identity_kubernetes_auths | ||
| const hasGatewayPoolId = await knex.schema.hasColumn(TableName.IdentityKubernetesAuth, "gatewayPoolId"); | ||
| if (hasGatewayPoolId) { | ||
| await knex.schema.alterTable(TableName.IdentityKubernetesAuth, (t) => { | ||
| t.dropColumn("gatewayPoolId"); | ||
| }); | ||
| } | ||
|
|
||
| await dropOnUpdateTrigger(knex, TableName.GatewayPoolMembership); | ||
| await knex.schema.dropTableIfExists(TableName.GatewayPoolMembership); | ||
|
|
||
| await dropOnUpdateTrigger(knex, TableName.GatewayPool); | ||
| await knex.schema.dropTableIfExists(TableName.GatewayPool); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Code generated by automation script, DO NOT EDIT. | ||
| // Automated by pulling database and generating zod schema | ||
| // To update. Just run npm run generate:schema | ||
| // Written by akhilmhdh. | ||
|
|
||
| import { z } from "zod"; | ||
|
|
||
| import { TImmutableDBKeys } from "./models"; | ||
|
|
||
| export const GatewayPoolMembershipsSchema = z.object({ | ||
| id: z.string().uuid(), | ||
| gatewayPoolId: z.string().uuid(), | ||
| gatewayId: z.string().uuid(), | ||
| createdAt: z.date(), | ||
| updatedAt: z.date() | ||
| }); | ||
|
|
||
| export type TGatewayPoolMemberships = z.infer<typeof GatewayPoolMembershipsSchema>; | ||
| export type TGatewayPoolMembershipsInsert = Omit<z.input<typeof GatewayPoolMembershipsSchema>, TImmutableDBKeys>; | ||
| export type TGatewayPoolMembershipsUpdate = Partial< | ||
| Omit<z.input<typeof GatewayPoolMembershipsSchema>, TImmutableDBKeys> | ||
| >; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // Code generated by automation script, DO NOT EDIT. | ||
| // Automated by pulling database and generating zod schema | ||
| // To update. Just run npm run generate:schema | ||
| // Written by akhilmhdh. | ||
|
|
||
| import { z } from "zod"; | ||
|
|
||
| import { TImmutableDBKeys } from "./models"; | ||
|
|
||
| export const GatewayPoolsSchema = z.object({ | ||
| id: z.string().uuid(), | ||
| orgId: z.string().uuid(), | ||
| name: z.string(), | ||
| createdAt: z.date(), | ||
| updatedAt: z.date() | ||
| }); | ||
|
|
||
| export type TGatewayPools = z.infer<typeof GatewayPoolsSchema>; | ||
| export type TGatewayPoolsInsert = Omit<z.input<typeof GatewayPoolsSchema>, TImmutableDBKeys>; | ||
| export type TGatewayPoolsUpdate = Partial<Omit<z.input<typeof GatewayPoolsSchema>, TImmutableDBKeys>>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.