feat: add tailnet v2 API support to coordinate endpoint (#11228)

closes #10532

Adds v2 support to the /coordinate endpoint via a query parameter.

v1 already has test cases, and we haven't implemented v2 at the client yet, so the only new test case is an unsupported version.
This commit is contained in:
Spike Curtis
2023-12-15 14:10:24 +04:00
committed by GitHub
parent a41cbb0f03
commit 211e59bf65
4 changed files with 55 additions and 2 deletions

View File

@ -473,6 +473,11 @@ func New(options *Options) *API {
Cache: wsconncache.New(api._dialWorkspaceAgentTailnet, 0),
}
}
api.TailnetClientService, err = tailnet.NewClientService(
api.Logger.Named("tailnetclient"), &api.TailnetCoordinator)
if err != nil {
api.Logger.Fatal(api.ctx, "failed to initialize tailnet client service", slog.Error(err))
}
workspaceAppsLogger := options.Logger.Named("workspaceapps")
if options.WorkspaceAppsStatsCollectorOptions.Logger == nil {
@ -1061,6 +1066,7 @@ type API struct {
Auditor atomic.Pointer[audit.Auditor]
WorkspaceClientCoordinateOverride atomic.Pointer[func(rw http.ResponseWriter) bool]
TailnetCoordinator atomic.Pointer[tailnet.Coordinator]
TailnetClientService *tailnet.ClientService
QuotaCommitter atomic.Pointer[proto.QuotaCommitter]
// WorkspaceProxyHostsFn returns the hosts of healthy workspace proxies
// for header reasons.