Skip to content

Enable gRPC port forwarder by default again #3431

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

Merged
merged 1 commit into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,8 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- {template: default.yaml, ssh-port-forwarder: true} # SSH port forwarder is currently still the default
- {template: fedora.yaml, ssh-port-forwarder: false} # gRPC port forwarder will become default in the future
template:
- default.yaml
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand All @@ -469,8 +468,6 @@ jobs:
run: brew uninstall --ignore-dependencies --force qemu
- name: Test
run: ./hack/test-templates.sh templates/${{ matrix.template }}
env:
LIMA_SSH_PORT_FORWARDER: ${{ matrix.ssh-port-forwarder }}
- if: failure()
uses: ./.github/actions/upload_failure_logs_if_exists
with:
Expand Down
12 changes: 8 additions & 4 deletions pkg/hostagent/hostagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type HostAgent struct {
instName string
instSSHAddress string
sshConfig *ssh.SSHConfig
portForwarder *portForwarder
portForwarder *portForwarder // legacy SSH port forwarder (deprecated)
grpcPortForwarder *portfwd.Forwarder

onClose []func() error // LIFO
Expand Down Expand Up @@ -644,9 +644,12 @@ func (a *HostAgent) processGuestAgentEvents(ctx context.Context, client *guestag
for _, f := range ev.Errors {
logrus.Warnf("received error from the guest: %q", f)
}
// useSSHFwd was false by default in v1.0, but reverted to true by default in v1.0.1
// due to stability issues
useSSHFwd := true
// History of the default value of useSSHFwd:
// - v0.1.0: true (effectively)
// - v1.0.0: false
// - v1.0.1: true
// - v1.1.0-beta.0: false
useSSHFwd := false
if envVar := os.Getenv("LIMA_SSH_PORT_FORWARDER"); envVar != "" {
b, err := strconv.ParseBool(os.Getenv("LIMA_SSH_PORT_FORWARDER"))
if err != nil {
Expand All @@ -656,6 +659,7 @@ func (a *HostAgent) processGuestAgentEvents(ctx context.Context, client *guestag
}
}
if useSSHFwd {
logrus.Warn("LIMA_SSH_PORT_FORWARDER is deprecated")
a.portForwarder.OnEvent(ctx, ev)
} else {
a.grpcPortForwarder.OnEvent(ctx, client, ev)
Expand Down
14 changes: 10 additions & 4 deletions website/content/en/docs/config/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,20 @@ This page documents the environment variables used in Lima.

### `LIMA_SSH_PORT_FORWARDER`

- **Description**: Specifies to use the SSH port forwarder (slow, stable) instead of gRPC (fast, unstable)
- **Default**: `true`
- **Description**: Specifies to use the SSH port forwarder (slow) instead of gRPC (fast, previously unstable)
- **Default**: `false` (since v1.1.0-beta.0)
- **Usage**:
```sh
export LIMA_SSH_PORT_FORWARDER=false
```
- **Note**: It is expected that this variable will be set to `false` by default in future
when the gRPC port forwarder is well matured.
- **Note**: Deprecated since v1.1. It is expected that this variable will be removed in future.
- **The history of the default value**:
| Version | Default value |
|---------------|---------------------|
| v0.1.0 | `true`, effectively |
| v1.0.0 | `false` |
| v1.0.1 | `true` |
| v1.1.0-beta.0 | `false` |

### `LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT`

Expand Down
13 changes: 10 additions & 3 deletions website/content/en/docs/config/port.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@ Lima supports automatic port-forwarding of localhost ports from guest to host.

Lima supports two port forwarders: SSH and GRPC.

The default port forwarder is SSH.
The default port forwarder is shown in the following table.

| Version | Default |
| ------------- | ------- |
| v0.1.0 | SSH |
| v1.0.0 | GRPC |
| v1.0.1 | SSH |
| v1.1.0-beta.0 | GRPC |

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.
The default was further reverted to GRPC in Lima v1.1, as the stability issues were resolved.

### Using SSH

SSH based port forwarding is the default and current model that is supported in Lima.
SSH based port forwarding is the legacy mode that was previously default.

To explicitly use SSH forwarding use the below command

Expand Down
1 change: 1 addition & 0 deletions website/content/en/docs/releases/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The following features are deprecated:
- CentOS 7 support
- Loading non-strict YAMLs (i.e., YAMLs with unknown properties)
- `limactl show-ssh` command (Use `ssh -F ~/.lima/default/ssh.config lima-default` instead)
- `LIMA_SSH_PORT_FORWARDER=true` (since Lima v1.1)

## Removed features
- YAML property `network`: deprecated in [Lima v0.7.0](https://github.com/lima-vm/lima/commit/07e68230e70b21108d2db3ca5e0efd0e43842fbd)
Expand Down
Loading