diff --git a/pkg/hostagent/hostagent.go b/pkg/hostagent/hostagent.go index 8d7a8d6830e..0be8761fc0d 100644 --- a/pkg/hostagent/hostagent.go +++ b/pkg/hostagent/hostagent.go @@ -654,8 +654,18 @@ func (a *HostAgent) processGuestAgentEvents(ctx context.Context, client *guestag for _, f := range ev.Errors { logrus.Warnf("received error from the guest: %q", f) } - env, _ := strconv.ParseBool(os.Getenv("LIMA_SSH_PORT_FORWARDER")) - if env { + // useSSHFwd was false by default in v1.0, but reverted to true by default in v1.0.1 + // due to stability issues + useSSHFwd := true + if envVar := os.Getenv("LIMA_SSH_PORT_FORWARDER"); envVar != "" { + b, err := strconv.ParseBool(os.Getenv("LIMA_SSH_PORT_FORWARDER")) + if err != nil { + logrus.WithError(err).Warnf("invalid LIMA_SSH_PORT_FORWARDER value %q", envVar) + } else { + useSSHFwd = b + } + } + if useSSHFwd { a.portForwarder.OnEvent(ctx, ev) } else { a.grpcPortForwarder.OnEvent(ctx, client, ev) diff --git a/website/content/en/docs/config/Port/_index.md b/website/content/en/docs/config/Port/_index.md index 33989fe27f4..70e3d492ead 100644 --- a/website/content/en/docs/config/Port/_index.md +++ b/website/content/en/docs/config/Port/_index.md @@ -7,11 +7,18 @@ Lima supports automatic port-forwarding of localhost ports from guest to host. ## Port forwarding types +Lima supports two port forwarders: SSH and GRPC. + +The default port forwarder is SSH. + +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. +In future, it is expected that GRPC will take over the default position again. + ### Using SSH -SSH based port forwarding is the default and current model that is supported in Lima prior to v1.0. +SSH based port forwarding is the default and current model that is supported in Lima. -To use SSH forwarding use the below command +To explicitly use SSH forwarding use the below command ```bash LIMA_SSH_PORT_FORWARDER=true limactl start @@ -22,7 +29,7 @@ LIMA_SSH_PORT_FORWARDER=true limactl start - Doesn't support UDP based port forwarding - Spans child process on host for running SSH master. -### Using GRPC (Default since Lima v1.0) +### Using GRPC | ⚡ Requirement | Lima >= 1.0 | |---------------|-------------| @@ -30,10 +37,10 @@ LIMA_SSH_PORT_FORWARDER=true limactl start In this model, lima uses existing GRPC communication (Host <-> Guest) to tunnel port forwarding requests. For each port forwarding request, a GRPC tunnel is created and this will be used for transmitting data -To disable this feature and use SSH forwarding use the following environment variable +To enable this feature, set `LIMA_SSH_PORT_FORWARDER` to `false`: ```bash -LIMA_SSH_PORT_FORWARDER=true limactl start +LIMA_SSH_PORT_FORWARDER=false limactl start ``` #### Advantages