-
Notifications
You must be signed in to change notification settings - Fork 894
feat: add single tailnet support to pgcoord #9351
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
a20d318
feat: add single tailnet support to pgcoord
coadler efa2071
fixup! feat: add single tailnet support to pgcoord
coadler 2976c00
fixup! feat: add single tailnet support to pgcoord
coadler a7b39df
separate table + use channels
coadler 618b0e0
fix migrations
coadler f50f929
fixup! fix migrations
coadler 3a5bb76
fixup! fix migrations
coadler 3ddc783
fixup! fix migrations
coadler c84626a
Merge branch 'main' into colin/single-pgcoord
coadler a0cb904
Merge branch 'main' into colin/single-pgcoord
coadler dcb007d
add subscriber subsystem
coadler bdd7ef1
fixup! add subscriber subsystem
coadler 751b22f
fixup! add subscriber subsystem
coadler 3af1af1
fixup! add subscriber subsystem
coadler 7762a73
querier <- subscriber
coadler 08501e6
Merge branch 'main' into colin/single-pgcoord
coadler eb681ff
fixup! Merge branch 'main' into colin/single-pgcoord
coadler 390e837
fixup! Merge branch 'main' into colin/single-pgcoord
coadler a1c3acf
fixup! Merge branch 'main' into colin/single-pgcoord
coadler 8256670
fixup! Merge branch 'main' into colin/single-pgcoord
coadler a75f6f1
add extensive multiagent tests
coadler d143d2d
use dedicated channels for querier subscribe and closing conns
coadler 036094f
fixup! use dedicated channels for querier subscribe and closing conns
coadler e8a2b01
fixup! use dedicated channels for querier subscribe and closing conns
coadler 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
coderd/database/migrations/000155_pg_coordinator_single_tailnet.down.sql
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,39 @@ | ||
BEGIN; | ||
|
||
ALTER TABLE | ||
tailnet_clients | ||
ADD COLUMN | ||
agent_id uuid; | ||
|
||
UPDATE | ||
tailnet_clients | ||
SET | ||
-- there's no reason for us to try and preserve data since coordinators will | ||
-- have to restart anyways, which will create all of the client mappings. | ||
agent_id = '00000000-0000-0000-0000-000000000000'::uuid; | ||
|
||
ALTER TABLE | ||
tailnet_clients | ||
ALTER COLUMN | ||
agent_id SET NOT NULL; | ||
|
||
DROP TABLE tailnet_client_subscriptions; | ||
DROP FUNCTION tailnet_notify_client_subscription_change; | ||
|
||
-- update the tailnet_clients trigger to the old version. | ||
CREATE OR REPLACE FUNCTION tailnet_notify_client_change() RETURNS trigger | ||
LANGUAGE plpgsql | ||
AS $$ | ||
BEGIN | ||
IF (OLD IS NOT NULL) THEN | ||
PERFORM pg_notify('tailnet_client_update', OLD.id || ',' || OLD.agent_id); | ||
RETURN NULL; | ||
END IF; | ||
IF (NEW IS NOT NULL) THEN | ||
PERFORM pg_notify('tailnet_client_update', NEW.id || ',' || NEW.agent_id); | ||
RETURN NULL; | ||
END IF; | ||
END; | ||
$$; | ||
|
||
COMMIT; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is required, how were our tests working before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only if you specify a database URL to run tests against. I needed to run a standalone postgres to see the logs and previously it wouldn't run the migrations. I can prob remove this, I'm not sure if it has any greater effects.