Merge pull request #1664 from weaveworks/weave-launch-plugin
Add plugin support to weave script. LGTM.
This commit is contained in:
commit
d802eb485b
2 files changed
+53
-1
No files matched your search
@@ -11,6 +11,7 @@ example](https://github.com/weaveworks/weave#example):
|
||||
* [Virtual ethernet switch](#virtual-ethernet-switch)
|
||||
* [Fast data path](#fast-data-path)
|
||||
* [Seamless Docker integration](#docker)
|
||||
* [Docker network plugin](#plugin)
|
||||
* [Address allocation](#addressing)
|
||||
* [Naming and discovery](#naming-and-discovery)
|
||||
* [Application isolation](#application-isolation)
|
||||
@@ -88,6 +89,24 @@ Containers started in this way that subsequently restart, either by an
|
||||
explicit `docker restart` command or by Docker restart policy, are
|
||||
re-attached to the weave network by the weave Docker API proxy.
|
||||
|
||||
### <a name="plugin"></a>Docker network plugin
|
||||
|
||||
Alternatively, you can use weave as a Docker plugin. First you must
|
||||
configure the Docker daemon to use a cluster store as documented
|
||||
[here](https://docs.docker.com/engine/userguide/networking/dockernetworks/#an-overlay-network);
|
||||
you can then launch weave and create a network:
|
||||
|
||||
$ weave launch
|
||||
$ weave launch-plugin
|
||||
$ docker network create --driver=weave weave
|
||||
|
||||
and then start a container:
|
||||
|
||||
$ docker run --net=weave -ti ubuntu
|
||||
|
||||
For more details see the
|
||||
[plugin README](https://github.com/weaveworks/docker-plugin).
|
||||
|
||||
### <a name="addressing"></a>Address allocation
|
||||
|
||||
Containers are automatically allocated an IP address that is unique
|
||||
|
||||
@@ -58,6 +58,7 @@ weave launch-proxy [-H <endpoint>] [--with-dns | --without-dns]
|
||||
[--hostname-match <regexp>]
|
||||
[--hostname-replacement <replacement>]
|
||||
[--rewrite-inspect]
|
||||
weave launch-plugin
|
||||
weave env [--restore]
|
||||
weave config
|
||||
weave connect [--replace] [<peer> ...]
|
||||
@@ -80,6 +81,7 @@ weave ps [<container_id> ...]
|
||||
weave stop
|
||||
weave stop-router
|
||||
weave stop-proxy
|
||||
weave stop-plugin
|
||||
weave reset
|
||||
weave rmpeer <peer_id>
|
||||
|
||||
@@ -288,6 +290,10 @@ fi
|
||||
BASE_IMAGE=$DOCKERHUB_USER/weave
|
||||
IMAGE=$BASE_IMAGE:$IMAGE_VERSION
|
||||
|
||||
BASE_PLUGIN_IMAGE=$DOCKERHUB_USER/plugin
|
||||
PLUGIN_IMAGE=$BASE_PLUGIN_IMAGE:$IMAGE_VERSION
|
||||
PLUGIN_CONTAINER_NAME=weaveplugin
|
||||
|
||||
PROCFS=${PROCFS:-/proc}
|
||||
DOCKER_BRIDGE=${DOCKER_BRIDGE:-docker0}
|
||||
CONTAINER_NAME=${WEAVE_CONTAINER_NAME:-weave}
|
||||
@@ -1549,6 +1555,19 @@ stop_proxy() {
|
||||
stop $PROXY_CONTAINER_NAME "Proxy"
|
||||
}
|
||||
|
||||
launch_plugin() {
|
||||
PLUGIN_CONTAINER=$(docker run --privileged -d --name=$PLUGIN_CONTAINER_NAME \
|
||||
--restart=always \
|
||||
--net=host \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /run/docker/plugins:/run/docker/plugins \
|
||||
$PLUGIN_IMAGE "$@")
|
||||
}
|
||||
|
||||
stop_plugin() {
|
||||
stop $PLUGIN_CONTAINER_NAME "Plugin"
|
||||
}
|
||||
|
||||
##########################################################################################
|
||||
|
||||
[ $(id -u) = 0 ] || {
|
||||
@@ -1647,7 +1666,7 @@ shift 1
|
||||
|
||||
case "$COMMAND" in
|
||||
setup)
|
||||
for img in $IMAGE $EXEC_IMAGE ; do
|
||||
for img in $IMAGE $EXEC_IMAGE $PLUGIN_IMAGE ; do
|
||||
docker pull $img
|
||||
done
|
||||
;;
|
||||
@@ -1699,6 +1718,11 @@ EOF
|
||||
launch_proxy "$@"
|
||||
echo $PROXY_CONTAINER
|
||||
;;
|
||||
launch-plugin)
|
||||
check_not_running $PLUGIN_CONTAINER_NAME $BASE_PLUGIN_IMAGE
|
||||
launch_plugin "$@"
|
||||
echo $PLUGIN_CONTAINER
|
||||
;;
|
||||
env|proxy-env)
|
||||
[ "$COMMAND" = "env" ] || deprecation_warning "$COMMAND" "'weave env'"
|
||||
if PROXY_ADDR=$(proxy_addr) ; then
|
||||
@@ -1754,6 +1778,11 @@ EOF
|
||||
echo " Service: proxy"
|
||||
echo " Address: $PROXY_ADDRS"
|
||||
fi
|
||||
if [ -z "$SUB_STATUS" ] && check_running $PLUGIN_CONTAINER_NAME 2>/dev/null ; then
|
||||
echo
|
||||
echo " Service: plugin"
|
||||
echo " DriverName: weave"
|
||||
fi
|
||||
[ -n "$SUB_STATUS" ] || echo
|
||||
[ $res -eq 0 ]
|
||||
;;
|
||||
@@ -1940,6 +1969,10 @@ EOF
|
||||
[ $# -eq 0 ] || usage
|
||||
stop_proxy
|
||||
;;
|
||||
stop-plugin)
|
||||
[ $# -eq 0 ] || usage
|
||||
stop_plugin
|
||||
;;
|
||||
reset)
|
||||
[ $# -eq 0 ] || usage
|
||||
warn_if_stopping_proxy_in_env
|
||||
|
||||
Reference in new issue
Block a user