From 2708bdf2f5e61f9d440fbaea0268c9689ffbcd5f Mon Sep 17 00:00:00 2001 From: Zachary Gershman Date: Fri, 12 Feb 2016 09:30:10 -0800 Subject: [PATCH] Create a plugin for up'ing a lo device - 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 --- .travis.yml | 6 +- Godeps/Godeps.json | 2 +- README.md | 9 ++- plugins/main/loopback/loopback.go | 40 +++++++++++ plugins/main/loopback/loopback_suite_test.go | 58 ++++++++++++++++ plugins/main/loopback/loopback_test.go | 70 ++++++++++++++++++++ scripts/priv-net-run.sh | 1 - 7 files changed, 182 insertions(+), 4 deletions(-) create mode 100644 plugins/main/loopback/loopback.go create mode 100644 plugins/main/loopback/loopback_suite_test.go create mode 100644 plugins/main/loopback/loopback_test.go diff --git a/.travis.yml b/.travis.yml index 34249a22..2c796907 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: go +sudo: required go: - 1.4 @@ -12,4 +13,7 @@ install: - go get ${TOOLS_CMD}/vet script: - - ./test + - sudo -E /bin/bash -c 'PATH=$GOROOT/bin:$PATH ./test' + +notifications: + email: false diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index ae04ed03..69a1c72b 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,6 +1,6 @@ { "ImportPath": "github.com/appc/cni", - "GoVersion": "go1.5.3", + "GoVersion": "go1.4.2", "Packages": [ "./..." ], diff --git a/README.md b/README.md index 933165ea..5c1c25b4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,9 @@ This repository includes a number of common plugins that can be found in plugins Please see Documentation/ folder for documentation about particular plugins. ## Running the plugins -The scripts/ directory contains two scripts, priv-net-run.sh and docker-run.sh, that can be used to exercise the plugins. +The scripts/ directory contains two scripts, `priv-net-run.sh` and `docker-run.sh`, that can be used to exercise the plugins. + +**note - priv-net-run.sh depends on `jq`** Start out by creating a netconf file to describe a network: @@ -46,6 +48,11 @@ $ cat >/etc/cni/net.d/10-mynet.conf </etc/cni/net.d/99-loopback.conf <