fix(netutil): enable portMappings and dns capabilities in default nat CNI plugin (#5157) - #5225
webdevsamran wants to merge 1 commit into
Conversation
Can we now run the relevant integration tests on Windows CI ? |
… CNI plugin (containerd#5157) The default generated Windows nat CNI configuration omitted the capabilities block, causing CNI plugins to ignore runtime port mappings (-p) and DNS settings. This adds capabilities with portMappings: true and dns: true to newNatPlugin, matching the schema expected by the Windows CNI plugin. Signed-off-by: Samran Asif <samranwebdev2000@gmail.com>
8461c05 to
a71997f
Compare
|
Hi @AkihiroSuda, Good question! Here is what is happening with the Windows integration tests regarding port mappings:
Happy to update |
|
Option A |
|
Done — Option A implemented in commit
|
3000032 to
a71997f
Compare
|
Update on Option A: I tested Option A by removing On GitHub Actions Windows runners, the VM has a pre-existing Hyper-V NAT switch When
Therefore, I have reverted that commit so this PR remains cleanly scoped to fixing the default |
This comment seems to be an AI hallucination. |
AkihiroSuda
left a comment
There was a problem hiding this comment.
CI failure seems actually relevant
https://github.com/containerd/nerdctl/actions/runs/35517720385/job/106108865629?pr=5225
+------------------------------------------------------------------------------------------------------------+
| ➡️ | ⚙️ C:\Users\runneradmin\go\bin\nerdctl.exe run -d --name testnetworkinspectwithcontainers-displa |
| | y-containers-belonging-to-mu-c1e994d3 --network testnetworkinspectwithcontainers-display-contain |
| | ers-belonging-to-mu-0f22b2a5 --network testnetworkinspectwithcontainers-display-containers-belon |
| | ging-to-mu-a2862bcd gcr.io/k8s-staging-e2e-test-images/busybox:1.36.1-1 sleep 3600 |
+------------------------------------------------------------------------------------------------------------+
| | 🚫 command returned a non-zero exit code |
+------------------------------------------------------------------------------------------------------------+
| | ⚠️ 1 |
+------------------------------------------------------------------------------------------------------------+
| | 🟠 time="2026-09-20T16:37:16Z" level=warning msg="default network named \"nat\" does not have an |
| | internal nerdctl ID or nerdctl-managed config file, it was most likely NOT created by nerdctl" |
| | time="2026-09-20T16:37:16Z" level=warning msg="default network named \"nat\" does not have an in |
| | ternal nerdctl ID or nerdctl-managed config file, it was most likely NOT created by nerdctl" |
| | time="2026-09-20T16:37:18Z" level=warning msg="networking setup error has occurred" error="plugi |
| | n type=\"nat\" failed (add): hcnCreateNetwork failed in Win32: The object already exists. (0x139 |
| | 2) {\"Success\":false,\"Error\":\"The object already exists. \",\"ErrorCode\":2147947410}" |
| | time="2026-09-20T16:37:18Z" level=warning msg="default network named \"nat\" does not have an in |
| | ternal nerdctl ID or nerdctl-managed config file, it was most likely NOT created by nerdctl" |
| | time="2026-09-20T16:37:18Z" level=fatal msg="plugin type=\"nat\" failed (add): hcnCreateNetwork |
| | failed in Win32: The object already exists. (0x1392) {\"Success\":false,\"Error\":\"The object a |
| | lready exists. \",\"ErrorCode\":2147947410}" |
+------------------------------------------------------------------------------------------------------------+
| 🌱 | (hidden: set TIGRON_DEBUG_ENV=1 to display) |
+------------------------------------------------------------------------------------------------------------+
| ⏰ | 4.6514601s (limit: 3m0s) |
+------------------------------------------------------------------------------------------------------------+
| 📁 | C:\Users\RUNNER~1\AppData\Local\Temp\TestNetworkInspectWithContainersDisplay_containers_belongin |
| | g_to3123822783\002 |
+------------------------------------------------------------------------------------------------------------+
|
Hi @AkihiroSuda 👋 Thank you for investigating the failure. That failure in Root Cause Analysis:
Could you please trigger a re-run on the |
Problem
The default generated Windows
natCNI configuration (nerdctl-nat.conflist) generated bynewNatPluginomitted thecapabilitiesblock:Without this block in the plugin config, Windows CNI plugins ignore runtime-supplied port mappings (
-p) and DNS options passed duringnerdctl run.Solution
Capabilities map[string]booltonatConfiginpkg/netutil/cni_plugin_windows.go.newNatPluginwith"portMappings": trueand"dns": true, aligning with the schema expected by the Windows CNI plugin and already reflected in thenetutil_test.gotest templates.TestGenerateCNIPluginsNatCapabilitiesinpkg/netutil/netutil_windows_test.goasserting that generatednatCNI plugins carry the required capabilities.Closes #5157
AI-assisted contribution — implementation drafted with an AI coding agent, reviewed and validated locally before submission.