HostResolver does not work with VZ
- Dominant language
- Go
- Stars
- 21.9k
- Forks
- 957
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 53
Description
I've been looking into a DNS issue that seems to be triggered by certain static DNS entries in the `hostResolver.hosts` setting, so assumed the error would be in `pkg/hostagent/dns/dns.go`.
The default template claims that the host resolver is enabled by default: https://github.com/lima-vm/lima/blob/9d815d5027037227ba2b4cddc9d19a583ec48ccc/templates/default.yaml#L567-L569
But this turns out not to be true when using VZ. The cidata code has a bug that prevents the host agent ports from being written to `lima.env`: https://github.com/lima-vm/lima/blob/9d815d5027037227ba2b4cddc9d19a583ec48ccc/pkg/cidata/cidata.go#L278-L283
This means that the host resolver has not been used with VZ contrary to our documentation. Which means we can't simply fix this bug because that would suddenly switch existing VZ instances to using the host resolver, which may be unwanted.
So I see 2 different options for us:
1. Fix the bug, but change the `hostResolver.enabled` default to `false` for VZ only.
2. Disallow using the host resolver with VZ because it looks like it never worked before, and it is unclear if anybody ever want this functionality. The host resolver exists to work around the limitations of DNS forwarding in QEMU.
The effort for both is about the same, as in both cases we would have to make the default dependent on the driver.
I guess my main reason to consider option 2 is that I don't want us to waste looking into host resolver issues when we could just rely on the gvisor implementation (ignoring for a moment that it too has a problem, which is how this whole story started).
So I'm looking for feedback from @lima-vm/maintainers if you favour option (1) or option (2), and why?
---
Unrelated, but I find it unfortunate that the static hosts are under `hostResolver.host`, and they are still being used in `usernet` networking even if `hostResolver.enabled` is false.
So these names should really be in a separate `staticHosts` section at the root of `lima.yaml`, but I don't know if we still want to make such changes before the 2.0 release with so many other things still in progress?
---
Almost forgot: the original DNS issue with static hosts and `usernet` is still unresolved, but really independent of this issue.
Contributor guide
Assessment
This issue has not been assessed yet.