Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fbda21a

Browse files
authored
feat: move moons experiment to ga (released) (coder#11285)
* feat: release moons experiment as ga
1 parent e8be092 commit fbda21a

File tree

20 files changed

+57
-205
lines changed

20 files changed

+57
-205
lines changed

coderd/apidoc/docs.go

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codersdk/deployment.go

-4
Original file line numberDiff line numberDiff line change
@@ -2073,10 +2073,6 @@ func (c *Client) BuildInfo(ctx context.Context) (BuildInfoResponse, error) {
20732073
type Experiment string
20742074

20752075
const (
2076-
// ExperimentMoons enabled the workspace proxy endpoints and CRUD. This
2077-
// feature is not yet complete in functionality.
2078-
ExperimentMoons Experiment = "moons"
2079-
20802076
// https://github.com/coder/coder/milestone/19
20812077
ExperimentWorkspaceActions Experiment = "workspace_actions"
20822078

docs/admin/workspace-proxies.md

-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
# Workspace Proxies
22

3-
> Workspace proxies are in an
4-
> [experimental state](../contributing/feature-stages.md#experimental-features)
5-
> and the behavior is subject to change. Use
6-
> [GitHub issues](https://github.com/coder/coder) to leave feedback. This
7-
> experiment must be specifically enabled with the `--experiments="moons"`
8-
> option on both coderd and the workspace proxy. If you have all experiements
9-
> enabled, you have to add moons as well. `--experiments="*,moons"`
10-
113
Workspace proxies provide low-latency experiences for geo-distributed teams.
124

135
Coder's networking does a best effort to make direct connections to a workspace.
@@ -130,10 +122,6 @@ coder:
130122
- name: CODER_WILDCARD_ACCESS_URL
131123
value: "*.<app_hostname_of_proxy>"
132124

133-
# enables new paid features that are in alpha state
134-
- name: CODER_EXPERIMENTS
135-
value: "*,moons"
136-
137125
tls:
138126
secretNames:
139127
- kubernetes-wsproxy-secret

docs/api/general.md

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/schemas.md

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

enterprise/cli/workspaceproxy_test.go

-20
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/stretchr/testify/require"
1010

1111
"github.com/coder/coder/v2/cli/clitest"
12-
"github.com/coder/coder/v2/coderd/coderdtest"
1312
"github.com/coder/coder/v2/codersdk"
1413
"github.com/coder/coder/v2/enterprise/coderd/coderdenttest"
1514
"github.com/coder/coder/v2/enterprise/coderd/license"
@@ -23,16 +22,7 @@ func Test_ProxyCRUD(t *testing.T) {
2322
t.Run("Create", func(t *testing.T) {
2423
t.Parallel()
2524

26-
dv := coderdtest.DeploymentValues(t)
27-
dv.Experiments = []string{
28-
string(codersdk.ExperimentMoons),
29-
"*",
30-
}
31-
3225
client, _ := coderdenttest.New(t, &coderdenttest.Options{
33-
Options: &coderdtest.Options{
34-
DeploymentValues: dv,
35-
},
3626
LicenseOptions: &coderdenttest.LicenseOptions{
3727
Features: license.Features{
3828
codersdk.FeatureWorkspaceProxy: 1,
@@ -94,17 +84,7 @@ func Test_ProxyCRUD(t *testing.T) {
9484

9585
t.Run("Delete", func(t *testing.T) {
9686
t.Parallel()
97-
98-
dv := coderdtest.DeploymentValues(t)
99-
dv.Experiments = []string{
100-
string(codersdk.ExperimentMoons),
101-
"*",
102-
}
103-
10487
client, _ := coderdenttest.New(t, &coderdenttest.Options{
105-
Options: &coderdtest.Options{
106-
DeploymentValues: dv,
107-
},
10888
LicenseOptions: &coderdenttest.LicenseOptions{
10989
Features: license.Features{
11090
codersdk.FeatureWorkspaceProxy: 1,

enterprise/coderd/coderd.go

+26-27
Original file line numberDiff line numberDiff line change
@@ -362,34 +362,33 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
362362
}
363363
api.derpMesh = derpmesh.New(options.Logger.Named("derpmesh"), api.DERPServer, meshTLSConfig)
364364

365-
if api.AGPL.Experiments.Enabled(codersdk.ExperimentMoons) {
366-
// Proxy health is a moon feature.
367-
api.ProxyHealth, err = proxyhealth.New(&proxyhealth.Options{
368-
Interval: options.ProxyHealthInterval,
369-
DB: api.Database,
370-
Logger: options.Logger.Named("proxyhealth"),
371-
Client: api.HTTPClient,
372-
Prometheus: api.PrometheusRegistry,
373-
})
374-
if err != nil {
375-
return nil, xerrors.Errorf("initialize proxy health: %w", err)
376-
}
377-
go api.ProxyHealth.Run(ctx)
378-
// Force the initial loading of the cache. Do this in a go routine in case
379-
// the calls to the workspace proxies hang and this takes some time.
380-
go api.forceWorkspaceProxyHealthUpdate(ctx)
381-
382-
// Use proxy health to return the healthy workspace proxy hostnames.
383-
f := api.ProxyHealth.ProxyHosts
384-
api.AGPL.WorkspaceProxyHostsFn.Store(&f)
385-
386-
// Wire this up to healthcheck.
387-
var fetchUpdater healthcheck.WorkspaceProxiesFetchUpdater = &workspaceProxiesFetchUpdater{
388-
fetchFunc: api.fetchWorkspaceProxies,
389-
updateFunc: api.ProxyHealth.ForceUpdate,
390-
}
391-
api.AGPL.WorkspaceProxiesFetchUpdater.Store(&fetchUpdater)
365+
// Moon feature init. Proxyhealh is a go routine to periodically check
366+
// the health of all workspace proxies.
367+
api.ProxyHealth, err = proxyhealth.New(&proxyhealth.Options{
368+
Interval: options.ProxyHealthInterval,
369+
DB: api.Database,
370+
Logger: options.Logger.Named("proxyhealth"),
371+
Client: api.HTTPClient,
372+
Prometheus: api.PrometheusRegistry,
373+
})
374+
if err != nil {
375+
return nil, xerrors.Errorf("initialize proxy health: %w", err)
376+
}
377+
go api.ProxyHealth.Run(ctx)
378+
// Force the initial loading of the cache. Do this in a go routine in case
379+
// the calls to the workspace proxies hang and this takes some time.
380+
go api.forceWorkspaceProxyHealthUpdate(ctx)
381+
382+
// Use proxy health to return the healthy workspace proxy hostnames.
383+
f := api.ProxyHealth.ProxyHosts
384+
api.AGPL.WorkspaceProxyHostsFn.Store(&f)
385+
386+
// Wire this up to healthcheck.
387+
var fetchUpdater healthcheck.WorkspaceProxiesFetchUpdater = &workspaceProxiesFetchUpdater{
388+
fetchFunc: api.fetchWorkspaceProxies,
389+
updateFunc: api.ProxyHealth.ForceUpdate,
392390
}
391+
api.AGPL.WorkspaceProxiesFetchUpdater.Store(&fetchUpdater)
393392

394393
err = api.PrometheusRegistry.Register(&api.licenseMetricsCollector)
395394
if err != nil {

enterprise/coderd/templates.go

-6
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,6 @@ func (api *API) templateRBACEnabledMW(next http.Handler) http.Handler {
344344

345345
func (api *API) moonsEnabledMW(next http.Handler) http.Handler {
346346
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
347-
// The experiment must be enabled.
348-
if !api.AGPL.Experiments.Enabled(codersdk.ExperimentMoons) {
349-
httpapi.RouteNotFound(rw)
350-
return
351-
}
352-
353347
// Entitlement must be enabled.
354348
api.entitlementsMu.RLock()
355349
proxy := api.entitlements.Features[codersdk.FeatureWorkspaceProxy].Enabled

enterprise/coderd/workspaceproxy_test.go

+7-65
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,13 @@ func TestRegions(t *testing.T) {
3636
t.Run("OK", func(t *testing.T) {
3737
t.Parallel()
3838

39-
dv := coderdtest.DeploymentValues(t)
40-
dv.Experiments = []string{
41-
string(codersdk.ExperimentMoons),
42-
"*",
43-
}
44-
4539
db, pubsub := dbtestutil.NewDB(t)
4640

4741
client, _ := coderdenttest.New(t, &coderdenttest.Options{
4842
Options: &coderdtest.Options{
49-
AppHostname: appHostname,
50-
Database: db,
51-
Pubsub: pubsub,
52-
DeploymentValues: dv,
43+
AppHostname: appHostname,
44+
Database: db,
45+
Pubsub: pubsub,
5346
},
5447
})
5548

@@ -79,20 +72,13 @@ func TestRegions(t *testing.T) {
7972
t.Run("WithProxies", func(t *testing.T) {
8073
t.Parallel()
8174

82-
dv := coderdtest.DeploymentValues(t)
83-
dv.Experiments = []string{
84-
string(codersdk.ExperimentMoons),
85-
"*",
86-
}
87-
8875
db, pubsub := dbtestutil.NewDB(t)
8976

9077
client, closer, api, _ := coderdenttest.NewWithAPI(t, &coderdenttest.Options{
9178
Options: &coderdtest.Options{
92-
AppHostname: appHostname,
93-
Database: db,
94-
Pubsub: pubsub,
95-
DeploymentValues: dv,
79+
AppHostname: appHostname,
80+
Database: db,
81+
Pubsub: pubsub,
9682
},
9783
LicenseOptions: &coderdenttest.LicenseOptions{
9884
Features: license.Features{
@@ -173,17 +159,10 @@ func TestRegions(t *testing.T) {
173159
t.Run("RequireAuth", func(t *testing.T) {
174160
t.Parallel()
175161

176-
dv := coderdtest.DeploymentValues(t)
177-
dv.Experiments = []string{
178-
string(codersdk.ExperimentMoons),
179-
"*",
180-
}
181-
182162
ctx := testutil.Context(t, testutil.WaitLong)
183163
client, _ := coderdenttest.New(t, &coderdenttest.Options{
184164
Options: &coderdtest.Options{
185-
AppHostname: appHostname,
186-
DeploymentValues: dv,
165+
AppHostname: appHostname,
187166
},
188167
})
189168

@@ -200,15 +179,7 @@ func TestWorkspaceProxyCRUD(t *testing.T) {
200179
t.Run("CreateAndUpdate", func(t *testing.T) {
201180
t.Parallel()
202181

203-
dv := coderdtest.DeploymentValues(t)
204-
dv.Experiments = []string{
205-
string(codersdk.ExperimentMoons),
206-
"*",
207-
}
208182
client, _ := coderdenttest.New(t, &coderdenttest.Options{
209-
Options: &coderdtest.Options{
210-
DeploymentValues: dv,
211-
},
212183
LicenseOptions: &coderdenttest.LicenseOptions{
213184
Features: license.Features{
214185
codersdk.FeatureWorkspaceProxy: 1,
@@ -251,15 +222,7 @@ func TestWorkspaceProxyCRUD(t *testing.T) {
251222
t.Run("Delete", func(t *testing.T) {
252223
t.Parallel()
253224

254-
dv := coderdtest.DeploymentValues(t)
255-
dv.Experiments = []string{
256-
string(codersdk.ExperimentMoons),
257-
"*",
258-
}
259225
client, _ := coderdenttest.New(t, &coderdenttest.Options{
260-
Options: &coderdtest.Options{
261-
DeploymentValues: dv,
262-
},
263226
LicenseOptions: &coderdenttest.LicenseOptions{
264227
Features: license.Features{
265228
codersdk.FeatureWorkspaceProxy: 1,
@@ -287,16 +250,9 @@ func TestProxyRegisterDeregister(t *testing.T) {
287250
t.Parallel()
288251

289252
setup := func(t *testing.T) (*codersdk.Client, database.Store) {
290-
dv := coderdtest.DeploymentValues(t)
291-
dv.Experiments = []string{
292-
string(codersdk.ExperimentMoons),
293-
"*",
294-
}
295-
296253
db, pubsub := dbtestutil.NewDB(t)
297254
client, _ := coderdenttest.New(t, &coderdenttest.Options{
298255
Options: &coderdtest.Options{
299-
DeploymentValues: dv,
300256
Database: db,
301257
Pubsub: pubsub,
302258
IncludeProvisionerDaemon: true,
@@ -635,16 +591,9 @@ func TestProxyRegisterDeregister(t *testing.T) {
635591
func TestIssueSignedAppToken(t *testing.T) {
636592
t.Parallel()
637593

638-
dv := coderdtest.DeploymentValues(t)
639-
dv.Experiments = []string{
640-
string(codersdk.ExperimentMoons),
641-
"*",
642-
}
643-
644594
db, pubsub := dbtestutil.NewDB(t)
645595
client, user := coderdenttest.New(t, &coderdenttest.Options{
646596
Options: &coderdtest.Options{
647-
DeploymentValues: dv,
648597
Database: db,
649598
Pubsub: pubsub,
650599
IncludeProvisionerDaemon: true,
@@ -732,16 +681,9 @@ func TestIssueSignedAppToken(t *testing.T) {
732681
func TestReconnectingPTYSignedToken(t *testing.T) {
733682
t.Parallel()
734683

735-
dv := coderdtest.DeploymentValues(t)
736-
dv.Experiments = []string{
737-
string(codersdk.ExperimentMoons),
738-
"*",
739-
}
740-
741684
db, pubsub := dbtestutil.NewDB(t)
742685
client, closer, api, user := coderdenttest.NewWithAPI(t, &coderdenttest.Options{
743686
Options: &coderdtest.Options{
744-
DeploymentValues: dv,
745687
Database: db,
746688
Pubsub: pubsub,
747689
IncludeProvisionerDaemon: true,

0 commit comments

Comments
 (0)