
- Believe we need sudo to create netns - Use syscall instead of relying on ip netns - Add sudo to .travis.yml - Needs more -E - Revert Godeps GoVersion to 1.4.2 - in travis, test command is run with all necessary env vars - Loopback plugin only works on 'lo' interface - Update README, add loopback plugin config - note script dependency on jq Signed-off-by: Gabe Rosenhouse <grosenhouse@pivotal.io>
21 lines
434 B
Bash
Executable File
21 lines
434 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
if [[ ${DEBUG} -gt 0 ]]; then set -x; fi
|
|
|
|
# Run a command in a private network namespace
|
|
# set up by CNI plugins
|
|
contid=$(printf '%x%x%x%x' $RANDOM $RANDOM $RANDOM $RANDOM)
|
|
netnspath=/var/run/netns/$contid
|
|
|
|
ip netns add $contid
|
|
./exec-plugins.sh add $contid $netnspath
|
|
|
|
|
|
function cleanup() {
|
|
./exec-plugins.sh del $contid $netnspath
|
|
ip netns delete $contid
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
ip netns exec $contid "$@"
|