feat(internal/cmd): Add 'instance tunnel' command#248
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new unikraft instance tunnel subcommand intended to forward a local port to a non-public instance via an intermediate TLS tunnel service, enabling testing scenarios that require internal VM traffic.
Changes:
- Adds
InstancesTunnelCmdto the instances command group. - Implements target parsing, instance/IP resolution, tunnel-proxy instance creation, and local-to-remote relaying over TLS.
- Adds control-channel heartbeats to keep the tunnel service connection alive.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
49d2539 to
8ae136d
Compare
8ae136d to
5e8f3e5
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I need to fix these + do one more pass so no rush |
5e8f3e5 to
b8e8437
Compare
|
Should be as decent as it gets, definitely an upgrade compared to kraftkit |
b8e8437 to
a5b1451
Compare
|
Have to rebase the code and to generate tests on Monday. |
dcaf1a6 to
c7622e6
Compare
jedevc
left a comment
There was a problem hiding this comment.
Needs a rebase, and to get the tests passing 🎉
|
I'll rebase and fix afterwards |
ccbfb69 to
1aa3b6d
Compare
|
once you agree with the changes, I will fixup the I am pretty sure I covered all your requests. It now even has multi-metro support The API is now: I tested that the usual + new stuff still works |
Signed-off-by: Cezar Craciunoiu <cezar@unikraft.io>
Signed-off-by: Cezar Craciunoiu <cezar@unikraft.io>
1aa3b6d to
ad763de
Compare
| var c *exec.Cmd | ||
| if args[0] == "unikraft" { | ||
| c = exec.CommandContext(t.Context(), env.unikraftPath, args[1:]...) | ||
| } else { | ||
| c = exec.CommandContext(t.Context(), args[0], args[1:]...) | ||
| } | ||
|
|
||
| c.Env = os.Environ() | ||
| c.Env = slices.DeleteFunc(c.Env, func(s string) bool { | ||
| return strings.HasPrefix(s, "UNIKRAFT_") | ||
| }) | ||
| c.Env = append(c.Env, "NO_COLOR=1") | ||
| c.Env = append(c.Env, "UNIKRAFT_CONFIG="+env.configPath) | ||
| c.Env = append(c.Env, "BUILDKIT_PROGRESS=quiet") | ||
| c.Env = append(c.Env, resource.UnikraftSandboxEnv+"="+env.sandboxPath) | ||
| c.Cancel = func() error { | ||
| return c.Process.Signal(os.Interrupt) | ||
| } | ||
| c.WaitDelay = 30 * time.Second |
| } | ||
| time.Sleep(500 * time.Millisecond) | ||
| } | ||
| t.Errorf("timed out waiting for %s to become reachable", addr) |
|
|
||
| TunnelProxyPorts []string `short:"p" name:"tunnel-proxy-port" help:"Remote port(s) exposed by the tunnel service. When a single value is given it is used as the starting port for multiple targets." default:"4444" hidden:""` | ||
| ProxyControlPort uint `short:"P" name:"tunnel-control-port" help:"Command-and-control port of the tunnel service." default:"4443" hidden:""` | ||
| TunnelServiceImage string ` name:"tunnel-image" help:"Image to use for the tunnel service." default:"official/utils/tunnel:1.0" hidden:""` |
Nodes need this option
--net-internal-traffic=vmin order to test it.The Tunlr also needs updating to remove the check for inter-vm comms.Done.
TODO: Update tests when platform is stable.
Blocked on: https://github.com/unikraft-cloud/platform/pull/705
Closes: TOOL-714