Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf721f3d

Browse files
chore: add--disable-direct tocoder exp scaletest workspace-traffic --ssh (#19632)
Relates tocoder/internal#888As part of our renewed connection scaletesting efforts, we want toscaletest coder in a scenario where direct connections aren't available(relatively common for our customers), and all concurrent connectionsare relayed via DERP.This PR adds a flag, `--disable-direct` that can be included on theexisting`coder exp scaletest workspace-traffic -ssh` to disable directconnections.
1 parent71ea919 commitf721f3d

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

‎cli/exp_scaletest.go‎

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ func (r *RootCmd) scaletestWorkspaceTraffic() *serpent.Command {
864864
tickInterval time.Duration
865865
bytesPerTickint64
866866
sshbool
867+
disableDirectbool
867868
useHostLoginbool
868869
appstring
869870
templatestring
@@ -1023,15 +1024,16 @@ func (r *RootCmd) scaletestWorkspaceTraffic() *serpent.Command {
10231024

10241025
// Setup our workspace agent connection.
10251026
config:= workspacetraffic.Config{
1026-
AgentID:agent.ID,
1027-
BytesPerTick:bytesPerTick,
1028-
Duration:strategy.timeout,
1029-
TickInterval:tickInterval,
1030-
ReadMetrics:metrics.ReadMetrics(ws.OwnerName,ws.Name,agent.Name),
1031-
WriteMetrics:metrics.WriteMetrics(ws.OwnerName,ws.Name,agent.Name),
1032-
SSH:ssh,
1033-
Echo:ssh,
1034-
App:appConfig,
1027+
AgentID:agent.ID,
1028+
BytesPerTick:bytesPerTick,
1029+
Duration:strategy.timeout,
1030+
TickInterval:tickInterval,
1031+
ReadMetrics:metrics.ReadMetrics(ws.OwnerName,ws.Name,agent.Name),
1032+
WriteMetrics:metrics.WriteMetrics(ws.OwnerName,ws.Name,agent.Name),
1033+
SSH:ssh,
1034+
DisableDirect:disableDirect,
1035+
Echo:ssh,
1036+
App:appConfig,
10351037
}
10361038

10371039
ifwebClient!=nil {
@@ -1117,6 +1119,13 @@ func (r *RootCmd) scaletestWorkspaceTraffic() *serpent.Command {
11171119
Description:"Send traffic over SSH, cannot be used with --app.",
11181120
Value:serpent.BoolOf(&ssh),
11191121
},
1122+
{
1123+
Flag:"disable-direct",
1124+
Env:"CODER_SCALETEST_WORKSPACE_TRAFFIC_DISABLE_DIRECT_CONNECTIONS",
1125+
Default:"false",
1126+
Description:"Disable direct connections for SSH traffic to workspaces. Does nothing if `--ssh` is not also set.",
1127+
Value:serpent.BoolOf(&disableDirect),
1128+
},
11201129
{
11211130
Flag:"app",
11221131
Env:"CODER_SCALETEST_WORKSPACE_TRAFFIC_APP",

‎scaletest/workspacetraffic/config.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ type Config struct {
2828

2929
SSHbool`json:"ssh"`
3030

31+
// Ignored unless SSH is true.
32+
DisableDirectbool`json:"ssh_disable_direct"`
33+
3134
// Echo controls whether the agent should echo the data it receives.
3235
// If false, the agent will discard the data. Note that setting this
3336
// to true will double the amount of data read from the agent for

‎scaletest/workspacetraffic/conn.go‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (c *rptyConn) Close() (err error) {
144144
}
145145

146146
//nolint:revive // Ignore requestPTY control flag.
147-
funcconnectSSH(ctx context.Context,client*codersdk.Client,agentID uuid.UUID,cmdstring,requestPTYbool) (rwc*countReadWriteCloser,errerror) {
147+
funcconnectSSH(ctx context.Context,client*codersdk.Client,agentID uuid.UUID,cmdstring,requestPTYbool,blockEndpointsbool) (rwc*countReadWriteCloser,errerror) {
148148
varclosers []func()error
149149
deferfunc() {
150150
iferr!=nil {
@@ -156,7 +156,9 @@ func connectSSH(ctx context.Context, client *codersdk.Client, agentID uuid.UUID,
156156
}
157157
}()
158158

159-
agentConn,err:=workspacesdk.New(client).DialAgent(ctx,agentID,&workspacesdk.DialAgentOptions{})
159+
agentConn,err:=workspacesdk.New(client).DialAgent(ctx,agentID,&workspacesdk.DialAgentOptions{
160+
BlockEndpoints:blockEndpoints,
161+
})
160162
iferr!=nil {
161163
returnnil,xerrors.Errorf("dial workspace agent: %w",err)
162164
}

‎scaletest/workspacetraffic/run.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (r *Runner) Run(ctx context.Context, _ string, logs io.Writer) (err error)
111111
// If echo is enabled, disable PTY to avoid double echo and
112112
// reduce CPU usage.
113113
requestPTY:=!r.cfg.Echo
114-
conn,err=connectSSH(ctx,r.client,agentID,command,requestPTY)
114+
conn,err=connectSSH(ctx,r.client,agentID,command,requestPTY,r.cfg.DisableDirect)
115115
iferr!=nil {
116116
logger.Error(ctx,"connect to workspace agent via ssh",slog.Error(err))
117117
returnxerrors.Errorf("connect to workspace via ssh: %w",err)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp