Skip to content
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

WSL: Use dnsmasq #1302

Merged
merged 6 commits into from
Feb 8, 2022
Merged

WSL: Use dnsmasq #1302

merged 6 commits into from
Feb 8, 2022

Conversation

mook-as
Copy link
Contributor

@mook-as mook-as commented Jan 21, 2022

This adds dnsmasq on Windows, and uses it for the rancher-desktop WSL distribution. It mostly forwards to the normal nameserver (by reading the resolv.conf from the data distribution), but additionally interprets /etc/hosts where we add the fake hostnames host.docker.internal and host.minikube.internal.

Requires rancher-sandbox/rancher-desktop-wsl-distro#23.
Fixes #893.

@mook-as mook-as marked this pull request as ready for review January 24, 2022 19:01
@jandubois
Copy link
Member

jandubois commented Jan 24, 2022

This PR defines the names host.docker.internal and host.minikube.internal.

We should use host.rancher-desktop.internal for compatibility with the lima version (which defines host.lima.internal, and we add host.rancher-desktop.internal, and host.docker.internal). The "lima" name is upstream, so we keep it, but obviously don't want it on the WSL2 version.

We should just add host.rancher-desktop.internal as the canonical name (also to be used in docs), and add host.docker.internal for compatibility reasons. I don't see a need to define host.minikube.internal at all.

Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bump WSL distro to v0.14 and make sure this PR isn't merged until after #1429 is merged.

@@ -8,7 +8,7 @@ import path from 'path';
import { download } from '../lib/download.mjs';

export default async function main() {
const v = '0.12';
const v = '0.13';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const v = '0.13';
const v = '0.14';

Assuming #1429 will get merged before this PR means we will be at v0.12.1, which includes a nerdctl bump to 0.16.1 for both the Lima Alpine image and the WSL distro.

Switching the WSL distro to v0.13 afterwards would revert nerdctl for WSL to 0.16.0 while keeping it for the Alpine ISO at 0.16.1.

This stops copying the wsl.conf over from the main WSL distribution, so
that we can provide different contents in the main one.

Signed-off-by: Mark Yen <mark.yen@suse.com>
This edits /etc/hosts on the main distribution to add entries for
host.docker.internal and host.minikube.internal for compatibility.  We copy
over the /etc/hosts file in the data distribution (which we still ask WSL
to generate), and then add lines we need.

Note that this doesn't appear to actually affect any containers, as moby
uses an internal file to generate /etc/hosts.

Signed-off-by: Mark Yen <mark.yen@suse.com>
This allows us to add entries to /etc/hosts and allow containers to resolve
them.

Signed-off-by: Mark Yen <mark.yen@suse.com>
Signed-off-by: Mark Yen <mark.yen@suse.com>
Also drop minikube.
rancher-sandbox#1302 (comment)

Signed-off-by: Mark Yen <mark.yen@suse.com>
Copy link
Contributor

@ericpromislow ericpromislow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One change to align with a recent merged PR and a nit or two

Signed-off-by: Mark Yen <mark.yen@suse.com>
@mook-as mook-as requested a review from ericpromislow February 8, 2022 00:18
Copy link
Contributor

@ericpromislow ericpromislow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine now

@mook-as mook-as merged commit d34cc89 into rancher-sandbox:main Feb 8, 2022
@mook-as mook-as deleted the wsl-dnsmasq branch February 8, 2022 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WSL: make host.docker.internal work
3 participants