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

Skip to content

chore: move moons out of experimental mode #10716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions codersdk/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -2039,10 +2039,6 @@ func (c *Client) BuildInfo(ctx context.Context) (BuildInfoResponse, error) {
type Experiment string

const (
// ExperimentMoons enabled the workspace proxy endpoints and CRUD. This
// feature is not yet complete in functionality.
ExperimentMoons Experiment = "moons"

// https://github.com/coder/coder/milestone/19
ExperimentWorkspaceActions Experiment = "workspace_actions"

Expand Down
12 changes: 0 additions & 12 deletions docs/admin/workspace-proxies.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# Workspace Proxies

> Workspace proxies are in an
> [experimental state](../contributing/feature-stages.md#experimental-features)
> and the behavior is subject to change. Use
> [GitHub issues](https://github.com/coder/coder) to leave feedback. This
> experiment must be specifically enabled with the `--experiments="moons"`
> option on both coderd and the workspace proxy. If you have all experiements
> enabled, you have to add moons as well. `--experiments="*,moons"`

Workspace proxies provide low-latency experiences for geo-distributed teams.

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

# enables new paid features that are in alpha state
- name: CODER_EXPERIMENTS
value: "*,moons"

tls:
secretNames:
- kubernetes-wsproxy-secret
Expand Down
2 changes: 0 additions & 2 deletions enterprise/cli/workspaceproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func Test_ProxyCRUD(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why keep the deployment values if you're not setting any experiments?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a lot of places....

string(codersdk.ExperimentMoons),
"*",
}

Expand Down Expand Up @@ -97,7 +96,6 @@ func Test_ProxyCRUD(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down
38 changes: 18 additions & 20 deletions enterprise/coderd/coderd.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,27 +354,25 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
}
api.derpMesh = derpmesh.New(options.Logger.Named("derpmesh"), api.DERPServer, meshTLSConfig)

if api.AGPL.Experiments.Enabled(codersdk.ExperimentMoons) {
// Proxy health is a moon feature.
api.ProxyHealth, err = proxyhealth.New(&proxyhealth.Options{
Interval: options.ProxyHealthInterval,
DB: api.Database,
Logger: options.Logger.Named("proxyhealth"),
Client: api.HTTPClient,
Prometheus: api.PrometheusRegistry,
})
if err != nil {
return nil, xerrors.Errorf("initialize proxy health: %w", err)
}
go api.ProxyHealth.Run(ctx)
// Force the initial loading of the cache. Do this in a go routine in case
// the calls to the workspace proxies hang and this takes some time.
go api.forceWorkspaceProxyHealthUpdate(ctx)

// Use proxy health to return the healthy workspace proxy hostnames.
f := api.ProxyHealth.ProxyHosts
api.AGPL.WorkspaceProxyHostsFn.Store(&f)
// Proxy health is a moon feature.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Proxy health is a moon feature.

api.ProxyHealth, err = proxyhealth.New(&proxyhealth.Options{
Interval: options.ProxyHealthInterval,
DB: api.Database,
Logger: options.Logger.Named("proxyhealth"),
Client: api.HTTPClient,
Prometheus: api.PrometheusRegistry,
})
if err != nil {
return nil, xerrors.Errorf("initialize proxy health: %w", err)
}
go api.ProxyHealth.Run(ctx)
// Force the initial loading of the cache. Do this in a go routine in case
// the calls to the workspace proxies hang and this takes some time.
go api.forceWorkspaceProxyHealthUpdate(ctx)

// Use proxy health to return the healthy workspace proxy hostnames.
f := api.ProxyHealth.ProxyHosts
api.AGPL.WorkspaceProxyHostsFn.Store(&f)

err = api.PrometheusRegistry.Register(&api.licenseMetricsCollector)
if err != nil {
Expand Down
6 changes: 0 additions & 6 deletions enterprise/coderd/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,6 @@ func (api *API) templateRBACEnabledMW(next http.Handler) http.Handler {

func (api *API) moonsEnabledMW(next http.Handler) http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// The experiment must be enabled.
if !api.AGPL.Experiments.Enabled(codersdk.ExperimentMoons) {
httpapi.RouteNotFound(rw)
return
}

// Entitlement must be enabled.
api.entitlementsMu.RLock()
proxy := api.entitlements.Features[codersdk.FeatureWorkspaceProxy].Enabled
Expand Down
8 changes: 0 additions & 8 deletions enterprise/coderd/workspaceproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func TestRegions(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down Expand Up @@ -81,7 +80,6 @@ func TestRegions(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down Expand Up @@ -149,7 +147,6 @@ func TestRegions(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand All @@ -176,7 +173,6 @@ func TestWorkspaceProxyCRUD(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}
client, _ := coderdenttest.New(t, &coderdenttest.Options{
Expand Down Expand Up @@ -227,7 +223,6 @@ func TestWorkspaceProxyCRUD(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}
client, _ := coderdenttest.New(t, &coderdenttest.Options{
Expand Down Expand Up @@ -263,7 +258,6 @@ func TestProxyRegisterDeregister(t *testing.T) {
setup := func(t *testing.T) (*codersdk.Client, database.Store) {
dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down Expand Up @@ -611,7 +605,6 @@ func TestIssueSignedAppToken(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down Expand Up @@ -708,7 +701,6 @@ func TestReconnectingPTYSignedToken(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down
2 changes: 0 additions & 2 deletions enterprise/coderd/workspaceproxycoordinator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func Test_agentIsLegacy(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down Expand Up @@ -97,7 +96,6 @@ func Test_agentIsLegacy(t *testing.T) {

dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down
5 changes: 0 additions & 5 deletions enterprise/wsproxy/wsproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func TestDERPOnly(t *testing.T) {

deploymentValues := coderdtest.DeploymentValues(t)
deploymentValues.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down Expand Up @@ -82,7 +81,6 @@ func TestDERP(t *testing.T) {

deploymentValues := coderdtest.DeploymentValues(t)
deploymentValues.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down Expand Up @@ -315,7 +313,6 @@ func TestDERPEndToEnd(t *testing.T) {

deploymentValues := coderdtest.DeploymentValues(t)
deploymentValues.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down Expand Up @@ -443,7 +440,6 @@ func TestWorkspaceProxyWorkspaceApps_Wsconncache(t *testing.T) {
deploymentValues.Dangerous.AllowPathAppSharing = clibase.Bool(opts.DangerousAllowPathAppSharing)
deploymentValues.Dangerous.AllowPathAppSiteOwnerAccess = clibase.Bool(opts.DangerousAllowPathAppSiteOwnerAccess)
deploymentValues.Experiments = []string{
string(codersdk.ExperimentMoons),
"*",
}

Expand Down Expand Up @@ -501,7 +497,6 @@ func TestWorkspaceProxyWorkspaceApps_SingleTailnet(t *testing.T) {
deploymentValues.Dangerous.AllowPathAppSharing = clibase.Bool(opts.DangerousAllowPathAppSharing)
deploymentValues.Dangerous.AllowPathAppSiteOwnerAccess = clibase.Bool(opts.DangerousAllowPathAppSiteOwnerAccess)
deploymentValues.Experiments = []string{
string(codersdk.ExperimentMoons),
string(codersdk.ExperimentSingleTailnet),
"*",
}
Expand Down
5 changes: 1 addition & 4 deletions site/src/components/Dashboard/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const Navbar: FC = () => {
const canViewDeployment = Boolean(permissions.viewDeploymentValues);
const canViewAllUsers = Boolean(permissions.readAllUsers);
const proxyContextValue = useProxy();
const dashboard = useDashboard();

return (
<NavbarView
Expand All @@ -30,9 +29,7 @@ export const Navbar: FC = () => {
canViewAuditLog={canViewAuditLog}
canViewDeployment={canViewDeployment}
canViewAllUsers={canViewAllUsers}
proxyContextValue={
dashboard.experiments.includes("moons") ? proxyContextValue : undefined
}
proxyContextValue={proxyContextValue}
/>
);
};
4 changes: 2 additions & 2 deletions site/src/components/DeploySettingsLayout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ export const Sidebar: React.FC = () => {
<SidebarNavItem href="network" icon={<SidebarNavItemIcon icon={Globe} />}>
Network
</SidebarNavItem>
{dashboard.experiments.includes("moons") && (
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed

<SidebarNavItem
href="workspace-proxies"
icon={<SidebarNavItemIcon icon={HubOutlinedIcon} />}
>
Workspace Proxies
</SidebarNavItem>
)}
}
<SidebarNavItem
href="security"
icon={<SidebarNavItemIcon icon={LockRounded} />}
Expand Down
9 changes: 0 additions & 9 deletions site/src/components/DeploySettingsLayout/optionValue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ describe("optionValue", () => {
additionalValues: ["single_tailnet", "deployment_health_page"],
expected: { single_tailnet: false, deployment_health_page: false },
},
{
option: {
...defaultOption,
name: "Experiments",
value: ["moons"],
},
additionalValues: ["single_tailnet", "deployment_health_page"],
expected: { single_tailnet: false, deployment_health_page: false },
},
{
option: {
...defaultOption,
Expand Down
12 changes: 1 addition & 11 deletions site/src/contexts/ProxyContext.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useQuery } from "react-query";
import { getWorkspaceProxies, getWorkspaceProxyRegions } from "api/api";
import { Region, WorkspaceProxy } from "api/typesGenerated";
import { useDashboard } from "components/Dashboard/DashboardProvider";
import {
createContext,
FC,
Expand Down Expand Up @@ -85,9 +84,6 @@ export const ProxyContext = createContext<ProxyContextValue | undefined>(
* ProxyProvider interacts with local storage to indicate the preferred workspace proxy.
*/
export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
const dashboard = useDashboard();
const experimentEnabled = dashboard?.experiments.includes("moons");

// Using a useState so the caller always has the latest user saved
// proxy.
const [userSavedProxy, setUserSavedProxy] = useState(loadUserSelectedProxy());
Expand Down Expand Up @@ -176,13 +172,7 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
proxyLatencies,
refetchProxyLatencies,
userProxy: userSavedProxy,
proxy: experimentEnabled
? proxy
: {
// If the experiment is disabled, then call 'getPreferredProxy' with the regions from
// the api call. The default behavior is to use the `primary` proxy.
...getPreferredProxy(proxiesResp || []),
},
proxy,
proxies: proxiesResp,
isLoading: proxiesLoading,
isFetched: proxiesFetched,
Expand Down
10 changes: 3 additions & 7 deletions site/src/pages/TerminalPage/TerminalPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { MONOSPACE_FONT_FAMILY } from "theme/constants";
import { pageTitle } from "utils/page";
import { useProxy } from "contexts/ProxyContext";
import Box from "@mui/material/Box";
import { useDashboard } from "components/Dashboard/DashboardProvider";
import type { Region } from "api/typesGenerated";
import { getLatencyColor } from "utils/latency";
import { ProxyStatusLatency } from "components/ProxyStatusLatency/ProxyStatusLatency";
Expand Down Expand Up @@ -68,7 +67,6 @@ const TerminalPage: FC = () => {
const workspaceAgent = workspace.data
? getMatchingAgentOrFirst(workspace.data, workspaceNameParts?.[1])
: undefined;
const dashboard = useDashboard();
const proxyContext = useProxy();
const selectedProxy = proxyContext.proxy.proxy;
const latency = selectedProxy
Expand Down Expand Up @@ -316,11 +314,9 @@ const TerminalPage: FC = () => {
prevLifecycleState.current === "starting" && <LoadedScriptsAlert />}
{terminalState === "disconnected" && <DisconnectedAlert />}
<div css={styles.terminal} ref={xtermRef} data-testid="terminal" />
{dashboard.experiments.includes("moons") &&
selectedProxy &&
latency && (
<BottomBar proxy={selectedProxy} latency={latency.latencyMS} />
)}
{selectedProxy && latency && (
<BottomBar proxy={selectedProxy} latency={latency.latencyMS} />
)}
</Box>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,7 @@ export const MockEntitlementsWithUserLimit: TypesGen.Entitlements = {
}),
};

export const MockExperiments: TypesGen.Experiment[] = ["moons"];
export const MockExperiments: TypesGen.Experiment[] = [];

export const MockAuditLog: TypesGen.AuditLog = {
id: "fbd2116a-8961-4954-87ae-e4575bd29ce0",
Expand Down