Add plugin code
This adds basic plugins. "main" types: veth, bridge, macvlan "ipam" type: host-local The code has been ported over from github.com/coreos/rkt project and adapted to fit the CNI spec.
This commit is contained in:
20
scripts/priv-net-run.sh
Executable file
20
scripts/priv-net-run.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# Run a command in a private network namespace
|
||||
# set up by CNI plugins
|
||||
|
||||
netnsname=$(printf '%x%x' $RANDOM $RANDOM)
|
||||
netnspath=/var/run/netns/$netnsname
|
||||
|
||||
ip netns add $netnsname
|
||||
ip netns exec $netnsname ip link set lo up
|
||||
./exec-plugins.sh add $netnspath
|
||||
|
||||
|
||||
function cleanup() {
|
||||
./exec-plugins.sh del $netnspath
|
||||
ip netns delete $netnsname
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
ip netns exec $netnsname $@
|
Reference in New Issue
Block a user