From c94b5188bd2a48dba26032efe23e5f5530a1ebcc Mon Sep 17 00:00:00 2001 From: Spike Curtis Date: Thu, 27 Jun 2024 15:38:21 +0400 Subject: [PATCH] fix: modify workspacesdk to ask for tailnet API 2.0 (#13684) #13617 bumped the Agent/Tailnet API minor version because it adds telemetry features. However, we don't actually use the protocol features yet, so it's a bit obnoxious for our CLI client to ask for the newest API version. This is particularly true of the CLI client, since that's distributed separately, so if an end user installs the latest CLI client and their organization hasn't fully upgraded, then it will fail to connect. Since we have a release coming up and the telemetry stuff won't make it, I think we should roll back to version 2.0 until we actually implement the telemetry stuff. That way the newest release (2.13) will work with Coder servers all the way back to 2.9. --- codersdk/workspacesdk/workspacesdk.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/codersdk/workspacesdk/workspacesdk.go b/codersdk/workspacesdk/workspacesdk.go index cb17150e80..04765c13d9 100644 --- a/codersdk/workspacesdk/workspacesdk.go +++ b/codersdk/workspacesdk/workspacesdk.go @@ -21,7 +21,6 @@ import ( "cdr.dev/slog" "github.com/coder/coder/v2/codersdk" "github.com/coder/coder/v2/tailnet" - "github.com/coder/coder/v2/tailnet/proto" ) // AgentIP is a static IPv6 address with the Tailscale prefix that is used to route @@ -241,7 +240,15 @@ func (c *Client) DialAgent(dialCtx context.Context, agentID uuid.UUID, options * return nil, xerrors.Errorf("parse url: %w", err) } q := coordinateURL.Query() - q.Add("version", proto.CurrentVersion.String()) + // TODO (ethanndickson) - the current version includes 2 additions we don't currently use: + // + // 2.1 GetAnnouncementBanners on the Agent API (version locked to Tailnet API) + // 2.2 PostTelemetry on the Tailnet API + // + // So, asking for API 2.2 just makes us incompatible back level servers, for no real benefit. + // As a temporary measure, we'll specifically ask for API version 2.0 until we implement sending + // telemetry. + q.Add("version", "2.0") coordinateURL.RawQuery = q.Encode() connector := runTailnetAPIConnector(ctx, options.Logger,