mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore: replace wsconncache with a single tailnet (#8176)
This commit is contained in:
@ -364,8 +364,23 @@ func New(options *Options) *API {
|
||||
}
|
||||
|
||||
api.Auditor.Store(&options.Auditor)
|
||||
api.workspaceAgentCache = wsconncache.New(api.dialWorkspaceAgentTailnet, 0)
|
||||
api.TailnetCoordinator.Store(&options.TailnetCoordinator)
|
||||
if api.Experiments.Enabled(codersdk.ExperimentSingleTailnet) {
|
||||
api.agentProvider, err = NewServerTailnet(api.ctx,
|
||||
options.Logger,
|
||||
options.DERPServer,
|
||||
options.DERPMap,
|
||||
&api.TailnetCoordinator,
|
||||
wsconncache.New(api._dialWorkspaceAgentTailnet, 0),
|
||||
)
|
||||
if err != nil {
|
||||
panic("failed to setup server tailnet: " + err.Error())
|
||||
}
|
||||
} else {
|
||||
api.agentProvider = &wsconncache.AgentProvider{
|
||||
Cache: wsconncache.New(api._dialWorkspaceAgentTailnet, 0),
|
||||
}
|
||||
}
|
||||
|
||||
api.workspaceAppServer = &workspaceapps.Server{
|
||||
Logger: options.Logger.Named("workspaceapps"),
|
||||
@ -377,7 +392,7 @@ func New(options *Options) *API {
|
||||
RealIPConfig: options.RealIPConfig,
|
||||
|
||||
SignedTokenProvider: api.WorkspaceAppsProvider,
|
||||
WorkspaceConnCache: api.workspaceAgentCache,
|
||||
AgentProvider: api.agentProvider,
|
||||
AppSecurityKey: options.AppSecurityKey,
|
||||
|
||||
DisablePathApps: options.DeploymentValues.DisablePathApps.Value(),
|
||||
@ -921,10 +936,10 @@ type API struct {
|
||||
derpCloseFunc func()
|
||||
|
||||
metricsCache *metricscache.Cache
|
||||
workspaceAgentCache *wsconncache.Cache
|
||||
updateChecker *updatecheck.Checker
|
||||
WorkspaceAppsProvider workspaceapps.SignedTokenProvider
|
||||
workspaceAppServer *workspaceapps.Server
|
||||
agentProvider workspaceapps.AgentProvider
|
||||
|
||||
// Experiments contains the list of experiments currently enabled.
|
||||
// This is used to gate features that are not yet ready for production.
|
||||
@ -951,7 +966,8 @@ func (api *API) Close() error {
|
||||
if coordinator != nil {
|
||||
_ = (*coordinator).Close()
|
||||
}
|
||||
return api.workspaceAgentCache.Close()
|
||||
_ = api.agentProvider.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
func compressHandler(h http.Handler) http.Handler {
|
||||
|
Reference in New Issue
Block a user