Skip to content

Commit c0efefe

Browse files
committed
Revert the default port forwarder to SSH
The GRPC port forwarder is still too unstable (issue 2859, etc.) Signed-off-by: Akihiro Suda <[email protected]>
1 parent 0199911 commit c0efefe

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

pkg/hostagent/hostagent.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,16 @@ func (a *HostAgent) processGuestAgentEvents(ctx context.Context, client *guestag
654654
for _, f := range ev.Errors {
655655
logrus.Warnf("received error from the guest: %q", f)
656656
}
657-
env, _ := strconv.ParseBool(os.Getenv("LIMA_SSH_PORT_FORWARDER"))
658-
if env {
657+
// useSSHFwd was false by default in v1.0, but reverted to true by default in v1.0.1
658+
// due to stability issues
659+
useSSHFwd := true
660+
if envVar := os.Getenv("LIMA_SSH_PORT_FORWARDER"); envVar != "" {
661+
useSSHFwd, err = strconv.ParseBool(os.Getenv("LIMA_SSH_PORT_FORWARDER"))
662+
if err != nil {
663+
return fmt.Errorf("invalid LIMA_SSH_PORT_FORWARDER value %q: %w", envVar, err)
664+
}
665+
}
666+
if useSSHFwd {
659667
a.portForwarder.OnEvent(ctx, ev)
660668
} else {
661669
a.grpcPortForwarder.OnEvent(ctx, client, ev)

website/content/en/docs/config/Port/_index.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ Lima supports automatic port-forwarding of localhost ports from guest to host.
77

88
## Port forwarding types
99

10+
Lima supports two port forwarder: SSH and GRPC.
11+
12+
The default port forwarder is SSH.
13+
14+
The default was once changed to GRPC in Lima v1.0, but it was reverted to SSH in v1.0.1 due to stability reasons.
15+
16+
In future, it is expected that GRPC will take over the default position again.
17+
1018
### Using SSH
1119

12-
SSH based port forwarding is the default and current model that is supported in Lima prior to v1.0.
20+
SSH based port forwarding is the default and current model that is supported in Lima.
1321

14-
To use SSH forwarding use the below command
22+
To explicitly use SSH forwarding use the below command
1523

1624
```bash
1725
LIMA_SSH_PORT_FORWARDER=true limactl start
@@ -22,18 +30,18 @@ LIMA_SSH_PORT_FORWARDER=true limactl start
2230
- Doesn't support UDP based port forwarding
2331
- Spans child process on host for running SSH master.
2432

25-
### Using GRPC (Default since Lima v1.0)
33+
### Using GRPC
2634

2735
| ⚡ Requirement | Lima >= 1.0 |
2836
|---------------|-------------|
2937

3038
In this model, lima uses existing GRPC communication (Host <-> Guest) to tunnel port forwarding requests.
3139
For each port forwarding request, a GRPC tunnel is created and this will be used for transmitting data
3240

33-
To disable this feature and use SSH forwarding use the following environment variable
41+
To enable this feature, set `LIMA_SSH_PORT_FORWARDER` to `false`:
3442

3543
```bash
36-
LIMA_SSH_PORT_FORWARDER=true limactl start
44+
LIMA_SSH_PORT_FORWARDER=false limactl start
3745
```
3846

3947
#### Advantages

0 commit comments

Comments
 (0)