Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Network Namespace Bug For Ctr (microsoft#1270)
If you try and run a hypervisor isolated container through ctr (.\ctr.exe run --runtime io.containerd.runhcs.v1 --rm --isolated mcr.microsoft.com/windows/nanoserver:1809 xenon-test cmd /c "echo Hello World!") currently you'll get "ctr: failure while creating namespace for container: network namespace not found: unknown". The normal path through ctr is no network namespace is passed, so our shim will try and make one. The namespace was being created via `hns.CreateNamespace` which stores the ID of the namespace in all caps, however later on in the process when we go to add the namespace to the uvm we re-grab a namespace object via `hcn.GetNamespaceByID` which populates the Id field in all lowercase. When we originally store the namespace in our map of known namespaces we use the hns packages casing, and when we go to add any endpoints to the vm (there shouldn't be any anyways if we went through ctr and didn't provide --cni) then we'll fail to find the namespace due to a casing mismatch. We already create the namespace for cri interactions with the hcn package so this truthfully brings this fallback path in line. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
- Loading branch information