Revision cbca369611ae77d075c2197d86cbbe0851b408a7 authored by Benjamin Leggett on 20 February 2024, 15:25:45 UTC, committed by Timo Beckers on 29 February 2024, 13:38:41 UTC
The previous netns package had a few problems. It shelled out to iproute2,
and it depended on both containernetworking/plugins/pkg/ns and vishvananda/netns,
which lead to some idiosyncratic API.

This commit addresses these issues and takes care of some much-needed API cleanup:

- Create a new netns with New()
- Open an existing pinned netns with OpenPinned()
- Execute code within the netns with ns.Do()
- Close with Close()

Pinning network namespaces is not supported, as there is currently little reason
for doing so. In case the requirement pops up again later, it can always be added.

All tests now use anonymous (non-pinned) network namespaces, and the netns created
for cilium-health also no longer leaves an entry in /var/run/netns.

Signed-off-by: Benjamin Leggett <benjamin.leggett@solo.io>
Co-authored-by: Timo Beckers <timo@isovalent.com>
1 parent 2063a21
History
File Mode Size
.devcontainer
.github
.nvim
.travis
.vscode
Documentation
api
bpf
bugtool
cilium-dbg
cilium-health
clustermesh-apiserver
contrib
daemon
examples
hack
hubble-relay
images
install
operator
pkg
plugins
test
tools
vendor
.authors.aux -rw-r--r-- 416 bytes
.clang-format -rw-r--r-- 7.6 KB
.clomonitor.yml -rw-r--r-- 984 bytes
.gitattributes -rw-r--r-- 887 bytes
.gitignore -rw-r--r-- 1.8 KB
.golangci.yaml -rw-r--r-- 4.1 KB
.mailmap -rw-r--r-- 6.5 KB
.openvex.json -rw-r--r-- 4.6 KB
.travis.yml -rw-r--r-- 506 bytes
AUTHORS -rw-r--r-- 46.9 KB
CODEOWNERS -rw-r--r-- 27.6 KB
CODE_OF_CONDUCT.md -rw-r--r-- 2.2 KB
CONTRIBUTING.md -rw-r--r-- 691 bytes
FURTHER_READINGS.rst -rw-r--r-- 6.4 KB
LICENSE -rw-r--r-- 11.1 KB
MAINTAINERS.md -rw-r--r-- 4.6 KB
Makefile -rw-r--r-- 26.6 KB
Makefile.defs -rw-r--r-- 7.3 KB
Makefile.docker -rw-r--r-- 7.1 KB
Makefile.kind -rw-r--r-- 16.7 KB
Makefile.quiet -rw-r--r-- 818 bytes
README.rst -rw-r--r-- 19.6 KB
SECURITY-INSIGHTS.yml -rw-r--r-- 2.1 KB
SECURITY.md -rw-r--r-- 1.0 KB
USERS.md -rw-r--r-- 33.7 KB
VERSION -rw-r--r-- 11 bytes
Vagrantfile -rw-r--r-- 14.9 KB
go.mod -rw-r--r-- 12.6 KB
go.sum -rw-r--r-- 94.8 KB
netlify.toml -rw-r--r-- 92 bytes
stable.txt -rw-r--r-- 8 bytes
vagrant_box_defaults.rb -rw-r--r-- 334 bytes

README.rst

back to top