Skip to content

Commit e05f714

Browse files
authored
Merge pull request #10402 from nasusoba/wsl
✨ Support e2e for WSL
2 parents 27b795a + e9f7ca9 commit e05f714

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/framework/cluster_proxy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ func (p *clusterProxy) GetWorkloadCluster(ctx context.Context, namespace, name s
287287
// gets the kubeconfig from the cluster
288288
config := p.getKubeconfig(ctx, namespace, name)
289289

290-
// if we are on mac and the cluster is a DockerCluster, it is required to fix the control plane address
290+
// if we are on mac or Windows Subsystem for Linux (WSL), and the cluster is a DockerCluster, it is required to fix the control plane address
291291
// by using localhost:load-balancer-host-port instead of the address used in the docker network.
292-
if goruntime.GOOS == "darwin" && p.isDockerCluster(ctx, namespace, name) {
292+
if (goruntime.GOOS == "darwin" || os.Getenv("WSL_DISTRO_NAME") != "") && p.isDockerCluster(ctx, namespace, name) {
293293
p.fixConfig(ctx, name, config)
294294
}
295295

test/framework/kubetest/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ func dockeriseKubeconfig(kubetestConfigDir string, kubeConfigPath string) (strin
252252
}
253253
newPath := path.Join(kubetestConfigDir, "kubeconfig")
254254

255-
// On CAPD, if not running on Linux, we need to use Docker's proxy to connect back to the host
255+
// On CAPD, if not running on Linux or the environment is Windows Subsystem for Linux (WSL), we need to use Docker's proxy to connect back to the host
256256
// to the CAPD cluster. Moby on Linux doesn't use the host.docker.internal DNS name.
257-
if runtime.GOOS != "linux" {
257+
if runtime.GOOS != "linux" || os.Getenv("WSL_DISTRO_NAME") != "" {
258258
for i := range kubeConfig.Clusters {
259259
kubeConfig.Clusters[i].Server = strings.ReplaceAll(kubeConfig.Clusters[i].Server, "127.0.0.1", "host.docker.internal")
260260
}

0 commit comments

Comments
 (0)