Skip to content

Add new WorkspaceUpdates tailnet RPC #14716

Closed
1 of 1 issue completed
Closed
Chore
1 of 1 issue completed
@spikecurtis

Description

@spikecurtis

Today, tailnet clients connect to exactly one workspace Agent known at start of day. In order to support a desktop native VPN to Coder workspaces, we need a new tailnet RPC that delivers a stream of updates about workspaces being created, started, stopped and deleted, so that the native RPC can automatically connect to available agents.

The RPC will be part of the Tailnet API, and adds the following messages and RPC calls:

message WorkspaceUpdatesRequest {}

message WorkspaceUpdate {
	repeated Workspace upserted_workspaces = 1;
	repeated Agent upserted_agents = 2;
	repeated Workspace deleted_workspaces = 3;
	repeated Agent deleted_agents = 4;
}

message Workspace {
	bytes id = 1; // UUID
	string name = 2;

	enum Status {
		UNKNOWN = 0;
		PENDING = 1;
		STARTING = 2;
		RUNNING = 3;
		STOPPING = 4;
		STOPPED = 5;
		FAILED = 6;
		CANCELING = 7;
		CANCELED = 8;
		DELETING = 9;
		DELETED = 10;
	}
	Status status = 3;
}

message Agent {
	bytes id = 1; // UUID
	string name = 2;
	bytes workspace_id = 3; // UUID
}

service Tailnet {
	rpc WorkspaceUpdates(WorkspaceUpdatesRequest) returns (stream WorkspaceUpdate);
}

Because the RPC is not tied to a specific agent, it will not be available on the existing api/v2/workspaceagents/<agent>/coordinate HTTP endpoint, and needs to be added to a new api/v2/users/me/tailnet endpoint.

Sub-issues

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions