-
Notifications
You must be signed in to change notification settings - Fork 669
Allow adding static names to hostresolver #650
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
Conversation
Forwarding the request to the defaultHandler could result in returning NXDOMAIN, which can break resolution of IPv4 addresses. Signed-off-by: Jan Dubois <[email protected]>
d6b2f68
to
41f0d54
Compare
Seems accidentally containing #643 Could you try rebasing with the master? |
Should be already fixed; maybe you need to refresh? |
Sorry, I did one more force-push to change the hostname address from
|
@@ -56,6 +52,9 @@ probes: | |||
exit 1 | |||
fi | |||
hint: See "/var/log/cloud-init-output.log". in the guest | |||
hostResolver: | |||
hosts: | |||
host.docker.internal: host.lima.internal | |||
portForwards: | |||
- guestSocket: "/run/user/{{.UID}}/docker.sock" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we split this yaml to another PR and hold it until right before the release of vNext, to avoid seeing “this example does not work” issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've restored the original script because I realized it is still required when hostResolver.enabled
is false
.
I've added comments to the file that should make it obvious that this feature requires lima 0.8.3 or later.
I've also added tests to the PR.
This is an alternative to adding them globally to /etc/hosts on the host (not the guest). It also allows aliasing them to host.lima.internal. This allows names to be resolved not just inside the guest, but also inside containers inside the guest, which only have access to /etc/resolv.conf, and not the full resolver inside the guest. Signed-off-by: Jan Dubois <[email protected]>
This is done automatically by systemd-resolved, in which case this change is ignored, but on e.g. Alpine this is required to connect to the VM using its own hostname. Signed-off-by: Jan Dubois <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@abiosoft You may want to look at the changes to |
This is an alternative to adding static names to
/etc/hosts
on the host, to make them available inside containers running in the guest. In addition this change allows creating aliases tohost.lima.internal
to point to the host gateway from inside the guest.Manual testing with
examples/docker.yaml
with these changes:Testing inside an Alpine container running on Docker:
In addition this PR contains a bugfix for the
hostResolver.ipv6: false
configuration: instead of forwardingAAAA
queries to the default resolvers, we now return an empty reply to avoid returningNXDOMAIN
. During testing I found that that was causing names to resolve correctly on Alpine even whendig
andnslookup
seemed to show proper DNS information. It might be a bug in the musl resolver.Finally this PR also adds the current hostname with the slirp IP address to the host resolver. This is done automatically by systemd-resolved, but necessary for e.g. Alpine.
Fixes #622