Skip to content
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

POD-1277 | SSH sessions and proxy full support #1602

Conversation

janekbaraniewski
Copy link
Contributor

@janekbaraniewski janekbaraniewski commented Jan 28, 2025

Fixes POD-1277

Example container state when running workspace

root ➜ /go $ ps -aux --forest
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         549  0.0  0.0   7616  6832 pts/4    Ss   13:45   0:00 bash
root         644  0.0  0.0   8160  3948 pts/4    R+   13:46   0:00  \_ ps -aux --forest
root           1  0.0  0.0   2316  1184 ?        Ss   13:45   0:00 /bin/sh -c echo Container started trap "exit 0" 15  exec "$@" while sleep 1 & wai
root         107  1.2  0.5 1328728 90264 ?       Sl   13:45   0:00 /usr/local/bin/devpod agent container network-daemon --access-key n2Z5MHx3EJRoFGf
root         115  0.7  0.4 1328216 72484 ?       Sl   13:45   0:00 /usr/local/bin/devpod helper ssh-server --track-activity
root         142  0.6  0.4 1327960 71172 ?       Sl   13:45   0:00  \_ /usr/local/bin/devpod helper ssh-server --workdir  --address 0.0.0.0:12023
root         193  0.0  0.0   5096  2392 ?        S    13:45   0:00  |   \_ su vscode
vscode       195  0.0  0.0   3788  2716 ?        S    13:45   0:00  |       \_ bash
vscode       202  0.0  0.0   2420  1428 ?        S    13:45   0:00  |           \_ sh
vscode       275 15.2  0.0  49352 15756 ?        Sl   13:45   0:01  |               \_ /home/vscode/.vscode-server/code-fabdb6a30b49f79a7aba0f2ad9df
vscode       325  0.0  0.0   2316  1364 ?        S    13:45   0:00  |               |   \_ sh /home/vscode/.vscode-server/cli/servers/Stable-fabdb6a
vscode       329 11.4  0.7 5285044 129456 ?      Sl   13:45   0:01  |               |       \_ /home/vscode/.vscode-server/cli/servers/Stable-fabdb6
vscode       367 16.6  0.7 13689456 116012 ?     Sl   13:45   0:01  |               |           \_ /home/vscode/.vscode-server/cli/servers/Stable-fa
vscode       378  0.8  0.3 5171244 51064 ?       Sl   13:45   0:00  |               |           \_ /home/vscode/.vscode-server/cli/servers/Stable-fa
vscode       391  1.9  0.3 5067124 60552 ?       Sl   13:45   0:00  |               |           \_ /home/vscode/.vscode-server/cli/servers/Stable-fa
vscode       305  0.0  0.0   2216  1148 ?        S    13:45   0:00  |               \_ sleep 180
root         180  0.2  0.4 1327704 67916 ?       Sl   13:45   0:00  \_ /usr/local/bin/devpod agent container credentials-server --user vscode --conf
root         194  0.2  0.4 1327960 68496 ?       Sl   13:45   0:00  \_ /usr/local/bin/devpod agent container credentials-server --user vscode --conf
root         643  0.0  0.0   2216  1148 ?        S    13:46   0:00 sleep 1

@@ -100,6 +101,76 @@ func (cmd *SSHCmd) Run(ctx context.Context, args []string) error {

type ExecFunc func(ctx context.Context, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

func StartTailscaleSSHSession(
Copy link
Member

Choose a reason for hiding this comment

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

Can we move this to pkg/tailscale or even pkg/platform? Afaik it's only used for pro anyway and machine indicates it's used for everything

Copy link
Member

Choose a reason for hiding this comment

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

On closer look, do we even need a separate function for this? 🤔 We don't seem to use the tsNet or I'm blind

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup correct this no longer seems to be needed. at some point during dev I was building ssh clients inside this func. Thx!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

merged terminal session handling with current machine.StartSSHSession implementation so we don't duplicate code here anymore. This ssh session handling (machine.RunSSHSession) can probably be now moved somewhere to pkg/ssh/ wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

yep, makes sense

@janekbaraniewski janekbaraniewski force-pushed the POD-1277/ssh-connection-feature-parity branch from 7bba28a to d19bdbe Compare January 28, 2025 11:53
@janekbaraniewski janekbaraniewski force-pushed the POD-1277/ssh-connection-feature-parity branch 2 times, most recently from 1abe432 to 4648603 Compare January 28, 2025 13:52
@janekbaraniewski janekbaraniewski force-pushed the POD-1277/ssh-connection-feature-parity branch from 4648603 to daad2dc Compare January 28, 2025 14:10
Copy link
Member

@pascalbreuninger pascalbreuninger left a comment

Choose a reason for hiding this comment

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

LGTM

@janekbaraniewski janekbaraniewski merged commit 6d0f6d3 into loft-sh:feature/tailscale-network-rewrite Jan 29, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants