fix: allow proxy version mismatch (with warning) (#12433)

This commit is contained in:
Dean Sheather
2024-03-20 18:24:18 +00:00
committed by GitHub
parent 4d9fe05f5a
commit 2b773f9034
12 changed files with 93 additions and 145 deletions
+9 -1
View File
@@ -168,7 +168,6 @@ func New(ctx context.Context, opts *Options) (*Server, error) {
client.SDKClient.HTTPClient = opts.HTTPClient
}
// TODO: Probably do some version checking here
info, err := client.SDKClient.BuildInfo(ctx)
if err != nil {
return nil, xerrors.Errorf("buildinfo: %w", errors.Join(
@@ -179,6 +178,15 @@ func New(ctx context.Context, opts *Options) (*Server, error) {
if info.WorkspaceProxy {
return nil, xerrors.Errorf("%q is a workspace proxy, not a primary coderd instance", opts.DashboardURL)
}
// We don't want to crash the proxy if the versions don't match because
// it'll enter crash loop backoff (and most patches don't make any backwards
// incompatible changes to the proxy API anyways)
if !buildinfo.VersionsMatch(info.Version, buildinfo.Version()) {
opts.Logger.Warn(ctx, "workspace proxy version doesn't match Minor.Major version of the primary, please keep them in sync",
slog.F("primary_version", info.Version),
slog.F("proxy_version", buildinfo.Version()),
)
}
meshTLSConfig, err := replicasync.CreateDERPMeshTLSConfig(opts.AccessURL.Hostname(), opts.TLSCertificates)
if err != nil {