Skip to content

Commit adc5a71

Browse files
authored
Merge pull request #2864 from AkihiroSuda/revert-portfwd
Revert the default port forwarder to SSH
2 parents 0199911 + ed49354 commit adc5a71

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

pkg/hostagent/hostagent.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,18 @@ 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+
b, err := strconv.ParseBool(os.Getenv("LIMA_SSH_PORT_FORWARDER"))
662+
if err != nil {
663+
logrus.WithError(err).Warnf("invalid LIMA_SSH_PORT_FORWARDER value %q", envVar)
664+
} else {
665+
useSSHFwd = b
666+
}
667+
}
668+
if useSSHFwd {
659669
a.portForwarder.OnEvent(ctx, ev)
660670
} else {
661671
a.grpcPortForwarder.OnEvent(ctx, client, ev)

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

+12-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@ Lima supports automatic port-forwarding of localhost ports from guest to host.
77

88
## Port forwarding types
99

10+
Lima supports two port forwarders: 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+
In future, it is expected that GRPC will take over the default position again.
16+
1017
### Using SSH
1118

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

14-
To use SSH forwarding use the below command
21+
To explicitly use SSH forwarding use the below command
1522

1623
```bash
1724
LIMA_SSH_PORT_FORWARDER=true limactl start
@@ -22,18 +29,18 @@ LIMA_SSH_PORT_FORWARDER=true limactl start
2229
- Doesn't support UDP based port forwarding
2330
- Spans child process on host for running SSH master.
2431

25-
### Using GRPC (Default since Lima v1.0)
32+
### Using GRPC
2633

2734
| ⚡ Requirement | Lima >= 1.0 |
2835
|---------------|-------------|
2936

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

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

3542
```bash
36-
LIMA_SSH_PORT_FORWARDER=true limactl start
43+
LIMA_SSH_PORT_FORWARDER=false limactl start
3744
```
3845

3946
#### Advantages

0 commit comments

Comments
 (0)