Skip to content

Add Windows e2e tests via kind-in-WSL#1799

Merged
k8s-ci-robot merged 1 commit into
kubernetes-client:masterfrom
tg123:copilot/refine-windows-net48-e2e-test
Jun 17, 2026
Merged

Add Windows e2e tests via kind-in-WSL#1799
k8s-ci-robot merged 1 commit into
kubernetes-client:masterfrom
tg123:copilot/refine-windows-net48-e2e-test

Conversation

@tg123

@tg123 tg123 commented Jun 8, 2026

Copy link
Copy Markdown
Member

Adds a new e2e classic (wsl) CI job that runs the KubernetesClient.Classic (.NET Framework 4.8) end-to-end tests against a real single-node Kubernetes cluster on Windows.

Approach

  • The kindest/node image (which bundles containerd, the kubelet, and the K8s control-plane components) is imported into WSL2 as a systemd-enabled distro using tg123/oci-to-wsl (SHA-pinned).
  • .github/e2e/bootstrap-kind.sh brings up the single-node control plane inside the WSL distro: it sets up cgroupfs (no systemd cgroup delegation needed), patches out the kindest/node kubelet drop-in that assumes a Docker cgroup namespace, runs kubeadm init, untaints the node, and applies the bundled kindnet CNI.
  • The Windows host obtains a kubeconfig pointing at the WSL VM's IP. Because .NET Framework 4.8 does not support custom trust stores, certificate-authority-data is replaced with insecure-skip-tls-verify (CI-only ephemeral cluster).
  • Only tests/E2E.Classic.Tests (net48) runs in this job. The existing Linux e2e job continues to cover the modern (net8/9/10) E2E.Tests and E2E.Aot.Tests suites.

Job requirements

  • runs-on: windows-2025 (WSL2 only ships on Windows Server 2025; windows-latest may still be Server 2022 with WSL1).

New test project

  • tests/E2E.Classic.Tests mirrors the pattern used by tests/E2E.Aot.Tests: a thin csproj that links the shared MinikubeFactAttribute.cs and Onebyone.cs and ships its own minimal MinikubeTests.cs (the full E2E.Tests suite depends on packages that don't support net48, such as LeaderElection, JsonPatch.Net, and Kubectl).
  • The project is excluded from the root traversal build on non-Windows runners.

The CLA-signing commit history was preserved by squashing into a single commit authored by Boshi LIAN <bolian@microsoft.com>.

Copilot AI review requested due to automatic review settings June 8, 2026 20:21
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 8, 2026
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 8, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 8, 2026
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 5f8cdaa to 2e5646e Compare June 8, 2026 20:23
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 8, 2026
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 2e5646e to 8372b8e Compare June 8, 2026 20:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds Windows end-to-end (E2E) CI coverage by running a single-node Kubernetes control plane inside WSL (imported from kindest/node via oci-to-wsl) and executing the existing .NET E2E test suites from the Windows host through WSL2 localhost forwarding.

Changes:

  • Adds a new e2e-windows-wsl GitHub Actions job that boots kind-in-WSL and runs tests/E2E.Tests + tests/E2E.Aot.Tests on Windows against https://127.0.0.1:6443.
  • Introduces an oci-to-wsl profile and a WSL-side bootstrap script to initialize Kubernetes in the imported distro.
  • Pins *.sh to LF line endings via .gitattributes to avoid CRLF issues when scripts are copied into WSL.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/buildtest.yaml Adds a Windows E2E job that provisions kind-in-WSL and runs the existing E2E test suites from the Windows host.
.github/e2e/kind-wsl.yaml Defines the oci-to-wsl profile used to import kindest/node into a systemd-enabled WSL distro.
.github/e2e/bootstrap-kind.sh Bootstraps a single-node kubeadm control plane inside the imported WSL distro.
.gitattributes Forces LF line endings for .sh files to prevent WSL script execution failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/buildtest.yaml Outdated
Comment thread .github/workflows/buildtest.yaml Outdated
Comment thread .github/e2e/bootstrap-kind.sh
Copilot AI review requested due to automatic review settings June 8, 2026 20:33
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 8372b8e to 6336c12 Compare June 8, 2026 20:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/buildtest.yaml Outdated
Comment thread .github/workflows/buildtest.yaml Outdated
Comment thread .github/e2e/bootstrap-kind.sh
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 6336c12 to 78cd893 Compare June 8, 2026 20:41
Copilot AI review requested due to automatic review settings June 8, 2026 20:51
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 78cd893 to 490877b Compare June 8, 2026 20:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/buildtest.yaml Outdated
Comment thread .github/workflows/buildtest.yaml Outdated
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 490877b to 400f208 Compare June 8, 2026 21:07
Copilot AI review requested due to automatic review settings June 8, 2026 21:22
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 400f208 to 430a929 Compare June 8, 2026 21:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/buildtest.yaml Outdated
Comment thread .github/workflows/buildtest.yaml Outdated
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch 2 times, most recently from 5acdf7e to ba4af61 Compare June 8, 2026 21:37
Copilot AI review requested due to automatic review settings June 8, 2026 21:37
Copilot AI review requested due to automatic review settings June 8, 2026 23:01
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 8cf9337 to 4db8454 Compare June 8, 2026 23:01
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch 2 times, most recently from a9f6967 to 0ff023f Compare June 8, 2026 23:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment thread tests/E2E.Classic.Tests/E2E.Classic.Tests.csproj
Comment thread .github/e2e/bootstrap-kind.sh
Comment thread .github/workflows/buildtest.yaml Outdated
Copilot AI review requested due to automatic review settings June 8, 2026 23:08
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 0ff023f to 297abdc Compare June 8, 2026 23:08
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch 2 times, most recently from 4631297 to 97d6584 Compare June 8, 2026 23:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/buildtest.yaml
Comment thread tests/E2E.Classic.Tests/MinikubeTests.cs
Comment thread tests/E2E.Classic.Tests/MinikubeTests.cs Outdated
Copilot AI review requested due to automatic review settings June 8, 2026 23:15
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 97d6584 to a66be43 Compare June 8, 2026 23:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread tests/E2E.Classic.Tests/MinikubeTests.cs
Comment thread .github/workflows/buildtest.yaml Outdated
@tg123 tg123 marked this pull request as ready for review June 8, 2026 23:22
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 8, 2026
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from a66be43 to a6dd603 Compare June 8, 2026 23:22
Comment thread Minikube.runsettings Outdated
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@copilot I don't think this file is necessary

Comment thread testEnvironments.json Outdated
@@ -0,0 +1,17 @@
{
"version": "1",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@copilot Why this file? rm?

Copilot AI review requested due to automatic review settings June 9, 2026 05:34
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from a6dd603 to 4de7f9b Compare June 9, 2026 05:34
@tg123 tg123 force-pushed the copilot/refine-windows-net48-e2e-test branch from 4de7f9b to 12920ec Compare June 9, 2026 05:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comment on lines +31 to +47
void Cleanup()
{
var pods = client.CoreV1.ListNamespacedPod(namespaceParameter);
while (pods.Items.Any(p => p.Metadata.Name == podName))
{
try
{
client.CoreV1.DeleteNamespacedPod(podName, namespaceParameter);
}
catch (HttpOperationException e)
{
if (e.Response.StatusCode == System.Net.HttpStatusCode.NotFound)
{
return;
}
}
}
Comment on lines +82 to +98
void Cleanup()
{
var pods = client.CoreV1.ListNamespacedPod(namespaceParameter);
while (pods.Items.Any(p => p.Metadata.Name == podName))
{
try
{
client.CoreV1.DeleteNamespacedPod(podName, namespaceParameter);
}
catch (HttpOperationException e)
{
if (e.Response.StatusCode == System.Net.HttpStatusCode.NotFound)
{
return;
}
}
}
Comment on lines +133 to +146
var pods = client.CoreV1.ListNamespacedPod(namespaceParameter);
var pod = pods.Items.First(p => p.Metadata.Name == podName);
if (pod.Status.Phase == "Running")
{
return pod;
}

if (DateTime.UtcNow > deadline)
{
throw new TimeoutException($"Pod {podName} did not become Running within 2 minutes (last phase: {pod.Status.Phase})");
}

await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false);
}
# container and drives kubeadm from the host through `docker exec`; here WSL
# boots the image's systemd directly, so the equivalent bootstrap is performed
# in place.
set -euxo pipefail
@brendandburns

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, tg123

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [brendandburns,tg123]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants