Merge branch '1.6'
This commit is contained in:
commit
027064cbdb
1 file changed
+17
-14
@@ -135,20 +135,19 @@ docker_run_options() {
|
|||||||
echo --privileged --net=host $(docker_sock_options)
|
echo --privileged --net=host $(docker_sock_options)
|
||||||
}
|
}
|
||||||
|
|
||||||
cni_volume_options() {
|
exec_options() {
|
||||||
[ "$1" = "setup" -o "$1" = "setup-cni" ] && echo -v /etc/cni:/etc/cni -v /opt/cni:/opt/cni
|
case "$1" in
|
||||||
}
|
setup|setup-cni|launch|launch-router)
|
||||||
|
echo -v /:/host -e HOST_ROOT=/host
|
||||||
launch_router_options() {
|
;;
|
||||||
[ "$1" = "launch" -o "$1" = "launch-router" ] && echo -v /:/host -e HOST_ROOT=/host
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
exec_remote() {
|
exec_remote() {
|
||||||
docker $DOCKER_CLIENT_ARGS run --rm \
|
docker $DOCKER_CLIENT_ARGS run --rm \
|
||||||
$(docker_run_options) \
|
$(docker_run_options) \
|
||||||
--pid=host \
|
--pid=host \
|
||||||
$(cni_volume_options "$@") \
|
$(exec_options "$@") \
|
||||||
$(launch_router_options "$@") \
|
|
||||||
-e DOCKERHUB_USER="$DOCKERHUB_USER" \
|
-e DOCKERHUB_USER="$DOCKERHUB_USER" \
|
||||||
-e WEAVE_VERSION \
|
-e WEAVE_VERSION \
|
||||||
-e WEAVE_DEBUG \
|
-e WEAVE_DEBUG \
|
||||||
@@ -1032,9 +1031,12 @@ peer_args() {
|
|||||||
create_cni_script() {
|
create_cni_script() {
|
||||||
cat >"$1" <<EOF
|
cat >"$1" <<EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
[ -z "\$CNI_NETNS" -o \$(echo "\$CNI_NETNS" | grep "^/proc/") ] || \\
|
||||||
|
EXTRA_VOLUMES="-v \$(dirname \$CNI_NETNS):\$(dirname \$CNI_NETNS)"
|
||||||
docker run --rm $(docker_run_options) --pid=host -i \\
|
docker run --rm $(docker_run_options) --pid=host -i \\
|
||||||
-e CNI_VERSION -e CNI_COMMAND -e CNI_CONTAINERID -e CNI_NETNS \\
|
-e CNI_VERSION -e CNI_COMMAND -e CNI_CONTAINERID -e CNI_NETNS \\
|
||||||
-e CNI_IFNAME -e CNI_ARGS -e CNI_PATH $(cni_volume_options setup) \\
|
-e CNI_IFNAME -e CNI_ARGS -e CNI_PATH \\
|
||||||
|
-v /etc/cni:/etc/cni -v /opt/cni:/opt/cni \$EXTRA_VOLUMES \\
|
||||||
$PLUGIN_IMAGE $COVERAGE_ARGS $2
|
$PLUGIN_IMAGE $COVERAGE_ARGS $2
|
||||||
EOF
|
EOF
|
||||||
chmod a+x "$1"
|
chmod a+x "$1"
|
||||||
@@ -1050,12 +1052,12 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
setup_cni() {
|
setup_cni() {
|
||||||
if [ -d /opt/cni/bin ] ; then
|
if [ -d $HOST_ROOT/opt/cni/bin ] ; then
|
||||||
create_cni_script /opt/cni/bin/weave-net --cni-net
|
create_cni_script $HOST_ROOT/opt/cni/bin/weave-net --cni-net
|
||||||
create_cni_script /opt/cni/bin/weave-ipam --cni-ipam
|
create_cni_script $HOST_ROOT/opt/cni/bin/weave-ipam --cni-ipam
|
||||||
fi
|
fi
|
||||||
if [ -d /etc/cni/net.d -a ! -f /etc/cni/net.d/10-weave.conf ] ; then
|
if [ -d $HOST_ROOT/etc/cni/net.d -a ! -f $HOST_ROOT/etc/cni/net.d/10-weave.conf ] ; then
|
||||||
create_cni_config /etc/cni/net.d/10-weave.conf
|
create_cni_config $HOST_ROOT/etc/cni/net.d/10-weave.conf
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1615,6 +1617,7 @@ launch_router() {
|
|||||||
done
|
done
|
||||||
eval "set -- $ARGS"
|
eval "set -- $ARGS"
|
||||||
|
|
||||||
|
setup_cni
|
||||||
create_bridge
|
create_bridge
|
||||||
# We set the router name to the bridge MAC, which in turn is
|
# We set the router name to the bridge MAC, which in turn is
|
||||||
# derived from the system UUID (if available), and thus stable
|
# derived from the system UUID (if available), and thus stable
|
||||||
|
|||||||
Reference in new issue
Block a user