Merge pull request #2030 from weaveworks/issues/1992-cni-plugin

Implement CNI plugin
This commit is contained in:
Adam Harrison committed 2016-03-21 10:51:19 +00:00
commit 3123418022
17 files changed
+669 -70

No files matched your search

+2 -6
View File
@@ -4,17 +4,13 @@
start_suite "Test docker restart policy"
pidof() {
docker_on $1 inspect -f '{{.State.Pid}}' $2
}
check_restart() {
OLD_PID=$(pidof $1 $2)
OLD_PID=$(container_pid $1 $2)
run_on $1 sudo kill $OLD_PID
for i in $(seq 1 30); do
NEW_PID=$(pidof $1 $2)
NEW_PID=$(container_pid $1 $2)
if [ $NEW_PID != 0 -a $NEW_PID != $OLD_PID ] ; then
return 0
+35
View File
@@ -0,0 +1,35 @@
#! /bin/bash
. ./config.sh
start_suite "Test CNI plugin"
cni_connect() {
pid=$(container_pid $1 $2)
docker_on $1 run --rm --privileged --net=host --pid=host -i \
-e CNI_VERSION=1 -e CNI_COMMAND=ADD -e CNI_CONTAINERID=c1 \
-e CNI_NETNS=/proc/$pid/ns/net -e CNI_IFNAME=eth0 -e CNI_PATH=/opt/cni/bin \
weaveworks/plugin:latest --cni-net <<EOF
{
"name": "weave",
"type": "weave-net"
}
EOF
}
weave_on $HOST1 launch
weave_on $HOST1 expose
C1=$(docker_on $HOST1 run --net=none --name=c1 -dt $SMALL_IMAGE /bin/sh)
C2=$(docker_on $HOST1 run --net=none --name=c2 -dt $SMALL_IMAGE /bin/sh)
cni_connect $HOST1 c1 >/dev/null
cni_connect $HOST1 c2 >/dev/null
C1IP=$(container_ip $HOST1 c1)
C2IP=$(container_ip $HOST1 c2)
assert_raises "exec_on $HOST1 c1 $PING $C2IP"
assert_raises "exec_on $HOST1 c2 $PING $C1IP"
end_suite
+4
View File
@@ -183,6 +183,10 @@ container_ip() {
weave_on $1 ps $2 | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
}
container_pid() {
docker_on $1 inspect -f '{{.State.Pid}}' $2
}
# assert_dns_record <host> <container> <name> [<ip> ...]
assert_dns_record() {
local host=$1