ci: pre-create HNS NAT network before CRI integration tests#2726
Closed
ci: pre-create HNS NAT network before CRI integration tests#2726
Conversation
Agent-Logs-Url: https://github.com/microsoft/hcsshim/sessions/4ad9e36e-3641-4f36-9cee-33a16887e211 Co-authored-by: rawahars <65640262+rawahars@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
rawahars
May 7, 2026 07:40
View session
rawahars
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
Run containerd CRI integration testsstep in theintegration-testsjob has been failing intermittently because no HNSnatnetwork exists on the runner when CRI tests start, sohcnCreateNetworkfails downstream.This adds a small
Pre-create HNS NAT networkstep that runs immediately before the CRI integration tests. It:hnsservice so HNS re-enumerates the host vNIC.HNS.psm1frommicrosoft/SDN(the same module kube-proxy and containerd CI use) —New-HnsNetwork/Get-HnsNetworkare not built-in cmdlets, they live in this module. The URL is pinned to commit710cad6fc9025c86e04ef5daa6eb53f577802448, which is the latest commit touching this file (no changes since 2018), so the fetch is reproducible.natHNS network with172.19.208.0/20/ gateway172.19.208.1only if one doesn't already exist. This subnet matches the default Windows containers / HNS picks for the built-innatnetwork on Server 2022, so it won't clash with anything the CNI plugin or containerd later creates.Get-HnsNetworkfor diagnostics.Why option A (vendor/fetch
HNS.psm1)New-HnsNetworkis not a built-in Windows cmdlet, which is why the manual reproduction in the issue producedThe term 'New-HnsNetwork' is not recognized…. The other approaches considered (callingInvoke-HnsRequestdirectly, or relying on the in-boxHostNetworkingServicemodule) either don't exist out-of-box or don't expose a one-shot NAT-create API. PullingHNS.psm1frommicrosoft/SDNis the same pattern used by kube-proxy, calico, and the containerd CI itself, so it's the most reliable fix.Scope
.github/workflows/ci.ymlintegration-testsjob is windows-only (matrix.os: [windows-2022]), so noif: runner.os == 'Windows'guard is needed.