Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1abdc3afcf | ||
|
|
b8f98a5387 | ||
|
|
cb3b858df6 | ||
|
|
afb0d5bd3d | ||
|
|
2d3e070288 | ||
|
|
138141ac9b | ||
|
|
fa56ad8bc3 | ||
|
|
9d29da8d27 | ||
|
|
68f2cb9caa | ||
|
|
d13c7ea7ee | ||
|
|
4c7c702b6d | ||
|
|
c05955d598 | ||
|
|
ca64ab54e7 | ||
|
|
e64442f6de | ||
|
|
987a1618e9 | ||
|
|
0ab95cdd27 | ||
|
|
b0d0c3d731 | ||
|
|
534dd8e16a | ||
|
|
79e703c8ac | ||
|
|
d4a98a58f4 | ||
|
|
72532324ed | ||
|
|
68106d804e | ||
|
|
efff6d6e63 | ||
|
|
6bbd8d7a4c | ||
|
|
9cbf0289d8 | ||
|
|
255d087416 | ||
|
|
8668f6bb1e | ||
|
|
95ee99d652 | ||
|
|
30583ec8f2 | ||
|
|
e370ef7007 | ||
|
|
42953faf70 | ||
|
|
6c29a1f648 | ||
|
|
fa29b18be7 | ||
|
|
40db885b3a | ||
|
|
ae0c16f375 | ||
|
|
909b751d6d | ||
|
|
9419ad16bf | ||
|
|
2c12c4f67e | ||
|
|
be11db45d8 | ||
|
|
30213bd71e | ||
|
|
b14501f358 | ||
|
|
e93a145bab | ||
|
|
8b245a442c | ||
|
|
041b6fe251 | ||
|
|
d128488339 | ||
|
|
c8c61adca4 | ||
|
|
7c8f33f525 | ||
|
|
15bf6eab1e | ||
|
|
10333b0f3e | ||
|
|
52a5ca8f88 | ||
|
|
b19f2df6f8 | ||
|
|
b3ac56e3d2 | ||
|
|
cc77ad2c65 | ||
|
|
24c2743a58 | ||
|
|
b49f5bdb99 | ||
|
|
28a1578d20 | ||
|
|
e78be1fc35 | ||
|
|
109e249aa6 | ||
|
|
402fe094f4 | ||
|
|
1c1b3248c0 | ||
|
|
60c5e11871 | ||
|
|
5cae747b36 | ||
|
|
ef0dae4ed3 | ||
|
|
2686be1b93 | ||
|
|
b845360091 | ||
|
|
953d451105 | ||
|
|
75d80c4828 | ||
|
|
877658d22e | ||
|
|
1c797ca901 | ||
|
|
520a72c8e6 | ||
|
|
98fec7e5aa | ||
|
|
038aac41fd | ||
|
|
c54fe016b1 | ||
|
|
9c9b46479d | ||
|
|
28c290074b | ||
|
|
b687484dda | ||
|
|
fd731beb87 | ||
|
|
35cc653737 | ||
|
|
1254d680ed | ||
|
|
23c0b6a04b | ||
|
|
ede1ec970c | ||
|
|
fbab5a7280 | ||
|
|
a92cfc1ffe | ||
|
|
178cf85183 | ||
|
|
272161b00b | ||
|
|
56155d0819 | ||
|
|
c711826996 | ||
|
|
eef6965590 | ||
|
|
4926cb6f9a | ||
|
|
d9ca54e777 | ||
|
|
1f6a6349a9 | ||
|
|
8f27f8f442 | ||
|
|
681109ba71 | ||
|
|
99c691745a | ||
|
|
1af5699948 | ||
|
|
ef7571f1ef | ||
|
|
c0726923f5 | ||
|
|
4d9eadde5b | ||
|
|
9da5cee8d9 | ||
|
|
ca22ecdf09 | ||
|
|
2e58e92d48 | ||
|
|
fd0c53b424 | ||
|
|
7b1e8ac1cf | ||
|
|
31b7e063e7 | ||
|
|
b5172f46c1 | ||
|
|
5a6cb8e708 | ||
|
|
c3c28ea27e | ||
|
|
623abeef4c | ||
|
|
5f30846092 | ||
|
|
6ddbc5cb57 | ||
|
|
f9f3b18ce4 | ||
|
|
dc2925263c | ||
|
|
56fd45f7ea | ||
|
|
21a0fc30e8 | ||
|
|
673d0af97d | ||
|
|
402400d4cb | ||
|
|
b1a66012bd | ||
|
|
85fa976a25 | ||
|
|
640b487914 | ||
|
|
7c84e24f48 |
No files matched your search
@@ -70,3 +70,6 @@ test/coverage.*
|
|||||||
*qemu-*-static
|
*qemu-*-static
|
||||||
terraform.tfstate
|
terraform.tfstate
|
||||||
terraform.tfstate.backup
|
terraform.tfstate.backup
|
||||||
|
|
||||||
|
# Website
|
||||||
|
site-build
|
||||||
+3
-3
@@ -61,9 +61,6 @@
|
|||||||
[submodule "vendor/github.com/hashicorp/go-cleanhttp"]
|
[submodule "vendor/github.com/hashicorp/go-cleanhttp"]
|
||||||
path = vendor/github.com/hashicorp/go-cleanhttp
|
path = vendor/github.com/hashicorp/go-cleanhttp
|
||||||
url = http://github.com/hashicorp/go-cleanhttp
|
url = http://github.com/hashicorp/go-cleanhttp
|
||||||
[submodule "vendor/github.com/appc/cni"]
|
|
||||||
path = vendor/github.com/appc/cni
|
|
||||||
url = https://github.com/appc/cni
|
|
||||||
[submodule "vendor/github.com/coreos/go-iptables"]
|
[submodule "vendor/github.com/coreos/go-iptables"]
|
||||||
path = vendor/github.com/coreos/go-iptables
|
path = vendor/github.com/coreos/go-iptables
|
||||||
url = https://github.com/coreos/go-iptables
|
url = https://github.com/coreos/go-iptables
|
||||||
@@ -124,3 +121,6 @@
|
|||||||
[submodule "vendor/github.com/weaveworks/common"]
|
[submodule "vendor/github.com/weaveworks/common"]
|
||||||
path = vendor/github.com/weaveworks/common
|
path = vendor/github.com/weaveworks/common
|
||||||
url = https://github.com/weaveworks/common
|
url = https://github.com/weaveworks/common
|
||||||
|
[submodule "vendor/github.com/containernetworking/cni"]
|
||||||
|
path = vendor/github.com/containernetworking/cni
|
||||||
|
url = https://github.com/containernetworking/cni
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
2.3.0
|
||||||
@@ -1,3 +1,88 @@
|
|||||||
|
## Release 1.9.7
|
||||||
|
|
||||||
|
This is identical to 1.9.6 with one additional bug-fix:
|
||||||
|
|
||||||
|
* weave-npc would block everything if `kubectl --hostname-override` was used #2995,#2996
|
||||||
|
|
||||||
|
## Release 1.9.6
|
||||||
|
|
||||||
|
Bug fixes and minor improvements
|
||||||
|
|
||||||
|
* Ensure that Kubernetes pods can contact a service implemented within
|
||||||
|
the same pod, by turning on "hairpin mode". This is required because
|
||||||
|
of a quiet change between Kubernetes 1.5 and 1.6. #2993
|
||||||
|
* Network Policy Controller (`weave-npc`) now checks local addresses
|
||||||
|
only, so it doesn't interfere with cross-cluster traffic. It should
|
||||||
|
be more efficient too #2622,#2973,#2979
|
||||||
|
* Stop reporting back to Kubernetes any issues encountered when
|
||||||
|
deleting a pod's network interface. This is required because
|
||||||
|
of a quiet change between Kubernetes 1.5 and 1.6. #2921,#2928
|
||||||
|
* Fixed an issue whereby `weave-npc` couldn't start because one
|
||||||
|
`ipset` was referring to another one and could not be destroyed #2915,#2949
|
||||||
|
* Improved the code which checks whether the kernel supports `ipset` #2934,#2935
|
||||||
|
* `weave-npc` now creates ipsets with only valid xml characters in the
|
||||||
|
name #2958,#2959
|
||||||
|
|
||||||
|
Build and Testing
|
||||||
|
|
||||||
|
* In build container use cross-compilers from debian package
|
||||||
|
repository, so they match other components #2940
|
||||||
|
* Pin the version of the linting tool `shfmt` so the set of things it
|
||||||
|
checks is stable #2987
|
||||||
|
* Fix lint error in script that runs smoke-tests #2962
|
||||||
|
* Moved website publishing from Wordpress to Netlify #2986
|
||||||
|
|
||||||
|
[Full list of changes](https://github.com/weaveworks/weave/milestone/55?closed=1).
|
||||||
|
|
||||||
|
## Release 1.9.5
|
||||||
|
|
||||||
|
Bug fixes and minor improvements
|
||||||
|
|
||||||
|
* Improve log messages generated if "hairpin" conditions are detected,
|
||||||
|
to make clear which kind is likely to cause problems #2808/#2926
|
||||||
|
* Filter out IPv6 peer addresses from Kubernetes; Weave Net currently
|
||||||
|
only supports IPv4 #2904/#2912
|
||||||
|
* Fix rare crash during initialization of weave-kube #2893/#2892
|
||||||
|
* Include overlay and encryption modes in checkpoint reports, in case
|
||||||
|
this is relevant to a version upgrade #2771/#2907
|
||||||
|
|
||||||
|
Build and Testing
|
||||||
|
|
||||||
|
* Ensure CI build can run gcloud tools #2887
|
||||||
|
* Prevent kubeadm from upgrading Kubernetes if we are trying to test an older version #2886
|
||||||
|
* Upgrade build scripts to support Kubernetes 1.6 #2880
|
||||||
|
|
||||||
|
[Full list of changes](https://github.com/weaveworks/weave/milestone/54?closed=1).
|
||||||
|
|
||||||
|
## Release 1.9.4
|
||||||
|
|
||||||
|
Bug fixes and minor improvements
|
||||||
|
|
||||||
|
* Support Kubernetes 1.6 by creating a new DaemonSet #2777,#2801
|
||||||
|
* Support Kubernetes 1.6 by allowing CNI callers to send a
|
||||||
|
network-delete request for a container that is not running or has
|
||||||
|
never been attached to the network #2850
|
||||||
|
* Leave non-weave ipsets alone in Network Policy Controller (e.g. when
|
||||||
|
running Weave Net alonside keepalived-vip) #2751,#2846
|
||||||
|
* Fix various small issues revealed by 'staticcheck' tool #2843,#2857
|
||||||
|
* Avoid leaving 'defunct' processes when weave-kube container restarts #2836,#2845
|
||||||
|
* When using the CNI plugin with a non-standard network configuration
|
||||||
|
file, the weave bridge could get the same IP as a container, if
|
||||||
|
'weave expose' hadn't run at that point #2839,#2856
|
||||||
|
|
||||||
|
Build and Testing
|
||||||
|
|
||||||
|
* Check that no defunct processes remain after each test #2852
|
||||||
|
* Update build and test scripts to work with Kubernetes 1.6 beta #2851
|
||||||
|
|
||||||
|
[Full list of changes](https://github.com/weaveworks/weave/milestone/53?closed=1).
|
||||||
|
|
||||||
|
## Release 1.9.3
|
||||||
|
|
||||||
|
Bug fixes and minor improvements
|
||||||
|
|
||||||
|
* Fixed a race condition in Fast Datapath encrypted connections which could lead Weave Net to crash: #2824, #2825.
|
||||||
|
|
||||||
## Release 1.9.2
|
## Release 1.9.2
|
||||||
|
|
||||||
Bug fixes and minor improvements
|
Bug fixes and minor improvements
|
||||||
|
|||||||
@@ -173,6 +173,8 @@ ifeq ($(BUILD_IN_CONTAINER),true)
|
|||||||
# It bind-mounts the source into the container and passes all important variables
|
# It bind-mounts the source into the container and passes all important variables
|
||||||
exes $(EXES) tests lint: $(BUILD_UPTODATE)
|
exes $(EXES) tests lint: $(BUILD_UPTODATE)
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
|
# Containernetworking has another copy of vishvananda/netlink which leads to duplicate definitions
|
||||||
|
-@rm -r vendor/github.com/containernetworking/cni/vendor
|
||||||
@mkdir -p $(shell pwd)/.pkg
|
@mkdir -p $(shell pwd)/.pkg
|
||||||
$(SUDO) docker run $(RM) $(RUN_FLAGS) \
|
$(SUDO) docker run $(RM) $(RUN_FLAGS) \
|
||||||
-v $(shell pwd):/go/src/github.com/weaveworks/weave \
|
-v $(shell pwd):/go/src/github.com/weaveworks/weave \
|
||||||
@@ -376,3 +378,14 @@ integration-tests: all testrunner
|
|||||||
# integration-tests
|
# integration-tests
|
||||||
#
|
#
|
||||||
RUNNER_ARGS="-parallel" ./test/run-integration-tests.sh
|
RUNNER_ARGS="-parallel" ./test/run-integration-tests.sh
|
||||||
|
|
||||||
|
# This target is only intended for use in Netlify CI environment for generating preview pages on feature branches and pull requests.
|
||||||
|
# We need to obtain website repository (checked out under `site-build`) and place `site` directory into the context (`site-build/_weave_net_docs`).
|
||||||
|
# We then run make in `site-build` and Netlify will publish the output (`site-build/_site`).
|
||||||
|
netlify-site-preview:
|
||||||
|
@mkdir -p site-build
|
||||||
|
@curl --user $(WEBSITE_GITHUB_USER) --silent 'https://codeload.github.com/weaveworks/website-next/tar.gz/$(WEBSITE_BRANCH)' \
|
||||||
|
| tar --extract --gunzip --directory site-build --strip 1
|
||||||
|
@cp -r site site-build/_weave_net_docs
|
||||||
|
@$(MAKE) -C site-build netlify_ensure_install
|
||||||
|
@$(MAKE) -C site-build BUILD_ENV=netlify
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
source "$STATE"
|
|
||||||
|
|
||||||
site_changes() {
|
|
||||||
curl -s https://api.github.com/repos/weaveworks/weave/pulls/$1/files |
|
|
||||||
jq -r '.[]|.status + " " + .filename' |
|
|
||||||
grep -oP '^(added|modified|removed) site/.*(?=\.md$)'
|
|
||||||
}
|
|
||||||
|
|
||||||
format_comment() {
|
|
||||||
if [ ! -d .git ] || ! BRANCH=$(git symbolic-ref --short HEAD) || [ -z "$BRANCH" ] ; then
|
|
||||||
echo "Could not determine branch" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "#### Documentation changes:"
|
|
||||||
while read ACTION PAGE; do
|
|
||||||
echo "$ACTION [${PAGE#site/}]($WP_DEV_URL/docs/net/${BRANCH#issues/}/${PAGE#site/}/)"
|
|
||||||
done | sort
|
|
||||||
}
|
|
||||||
|
|
||||||
post_comment() {
|
|
||||||
jq -s -R '. | tostring | { body: . }' |
|
|
||||||
curl -s -d @- \
|
|
||||||
-H "Authorization: Bearer $WP_GH_COMMENT_TOKEN" \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
https://api.github.com/repos/weaveworks/weave/issues/$GH_PR/comments > /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
cd $SRCDIR
|
|
||||||
bin/install-wordepress v1.0.0
|
|
||||||
bin/publish-site "$WP_DEV_URL" "$WP_DEV_USER" "$WP_DEV_PASSWORD"
|
|
||||||
|
|
||||||
if [ -n "$WP_GH_COMMENT_TOKEN" -a -n "$GH_PR" ] ; then
|
|
||||||
echo ">>> Adding doc changelog to GitHub PR $GH_PR"
|
|
||||||
if CHANGES=$(site_changes $GH_PR) && [ -n "$CHANGES" ] ; then
|
|
||||||
echo "$CHANGES" | format_comment | post_comment
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
@@ -11,7 +11,3 @@ if [ -n "$TEST_AND_PUBLISH" ] ; then
|
|||||||
# CircleCI doesn't let us install the qemu module to do ARM docker builds
|
# CircleCI doesn't let us install the qemu module to do ARM docker builds
|
||||||
make publish ALL_ARCHITECTURES=amd64 UPDATE_LATEST=latest-only
|
make publish ALL_ARCHITECTURES=amd64 UPDATE_LATEST=latest-only
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $SRCDIR
|
|
||||||
bin/install-wordepress v1.0.0
|
|
||||||
bin/publish-site "$WP_DEV_URL" "$WP_DEV_USER" "$WP_DEV_PASSWORD"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
cd $SRCDIR
|
|
||||||
bin/install-wordepress v1.0.0
|
|
||||||
bin/publish-site "$WP_LIVE_URL" "$WP_LIVE_USER" "$WP_LIVE_PASSWORD"
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ $# -ne 1 ] ; then
|
|
||||||
echo USAGE: install-wordepress [COMMIT-ISH] >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
go get github.com/weaveworks/wordepress
|
|
||||||
cd /home/ubuntu/src/github.com/weaveworks/wordepress
|
|
||||||
git checkout $1
|
|
||||||
cd cmd/wordepress
|
|
||||||
go get
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
PRODUCT=net
|
|
||||||
|
|
||||||
fatal() {
|
|
||||||
echo "$@" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ ! -d .git ] ; then
|
|
||||||
fatal "Current directory is not a git clone"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! BRANCH=$(git symbolic-ref --short HEAD) || [ -z "$BRANCH" ] ; then
|
|
||||||
fatal "Could not determine branch"
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$BRANCH" in
|
|
||||||
issues/*)
|
|
||||||
VERSION="${BRANCH#issues/}"
|
|
||||||
TAGS="$VERSION"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if echo "$BRANCH" | grep -qE '^[0-9]+\.[0-9]+' ; then
|
|
||||||
DESCRIBE=$(git describe --match 'v*')
|
|
||||||
if ! VERSION=$(echo "$DESCRIBE" | grep -oP '(?<=^v)[0-9]+\.[0-9]+\.[0-9]+') ; then
|
|
||||||
fatal "Could not infer latest $BRANCH version from $DESCRIBE"
|
|
||||||
fi
|
|
||||||
TAGS="latest"
|
|
||||||
else
|
|
||||||
VERSION="$BRANCH"
|
|
||||||
TAGS="$VERSION"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
for TAG in $TAGS ; do
|
|
||||||
echo ">>> Publishing $PRODUCT $VERSION to $1/docs/$PRODUCT/$TAG"
|
|
||||||
wordepress \
|
|
||||||
--url "$1" --user "$2" --password "$3" \
|
|
||||||
--product "$PRODUCT" --version "$VERSION" --tag "$TAG" \
|
|
||||||
publish site
|
|
||||||
done
|
|
||||||
+15
@@ -90,6 +90,7 @@ build() {
|
|||||||
## (library versions?)
|
## (library versions?)
|
||||||
sed -i "/SCRIPT_VERSION=/ c\SCRIPT_VERSION=\"$VERSION\"" ./weave
|
sed -i "/SCRIPT_VERSION=/ c\SCRIPT_VERSION=\"$VERSION\"" ./weave
|
||||||
sed -i -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset.yaml
|
sed -i -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset.yaml
|
||||||
|
sed -i -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.6.yaml
|
||||||
make SUDO=$SUDO WEAVE_VERSION=$VERSION DOCKERHUB_USER=$DOCKERHUB_USER
|
make SUDO=$SUDO WEAVE_VERSION=$VERSION DOCKERHUB_USER=$DOCKERHUB_USER
|
||||||
|
|
||||||
if make tests; then
|
if make tests; then
|
||||||
@@ -165,6 +166,13 @@ draft() {
|
|||||||
--name "weave-daemonset.yaml" \
|
--name "weave-daemonset.yaml" \
|
||||||
--file "./prog/weave-kube/weave-daemonset.yaml"
|
--file "./prog/weave-kube/weave-daemonset.yaml"
|
||||||
|
|
||||||
|
github-release upload \
|
||||||
|
--user $GITHUB_USER \
|
||||||
|
--repo weave \
|
||||||
|
--tag $LATEST_TAG \
|
||||||
|
--name "weave-daemonset-k8s-1.6.yaml" \
|
||||||
|
--file "./prog/weave-kube/weave-daemonset-k8s-1.6.yaml"
|
||||||
|
|
||||||
echo "** Draft $TYPE $RELEASE_NAME $VERSION created at"
|
echo "** Draft $TYPE $RELEASE_NAME $VERSION created at"
|
||||||
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/$LATEST_TAG"
|
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/$LATEST_TAG"
|
||||||
}
|
}
|
||||||
@@ -251,6 +259,13 @@ publish() {
|
|||||||
--name "weave-daemonset.yaml" \
|
--name "weave-daemonset.yaml" \
|
||||||
--file "./prog/weave-kube/weave-daemonset.yaml"
|
--file "./prog/weave-kube/weave-daemonset.yaml"
|
||||||
|
|
||||||
|
github-release upload \
|
||||||
|
--user $GITHUB_USER \
|
||||||
|
--repo weave \
|
||||||
|
--tag latest_release \
|
||||||
|
--name "weave-daemonset-k8s-1.6.yaml" \
|
||||||
|
--file "./prog/weave-kube/weave-daemonset-k8s-1.6.yaml"
|
||||||
|
|
||||||
echo "** Release $RELEASE_NAME $VERSION published at"
|
echo "** Release $RELEASE_NAME $VERSION published at"
|
||||||
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/$LATEST_TAG"
|
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/$LATEST_TAG"
|
||||||
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/latest_release"
|
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/latest_release"
|
||||||
|
|||||||
+8
-5
@@ -20,13 +20,12 @@ ENV GCC_CROSSCOMPILERS \
|
|||||||
|
|
||||||
# Temporarily add the Ubuntu repositories, because we're going to install gcc cross-compilers from there
|
# Temporarily add the Ubuntu repositories, because we're going to install gcc cross-compilers from there
|
||||||
# Install the build-essential and crossbuild-essential-ARCH packages
|
# Install the build-essential and crossbuild-essential-ARCH packages
|
||||||
RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main universe" > /etc/apt/sources.list.d/cgocrosscompiling.list \
|
RUN echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/cgocrosscompiling.list \
|
||||||
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 3B4FE6ACC0B21F32 \
|
&& curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add - \
|
||||||
|
&& for platform in ${DEB_CROSSPLATFORMS}; do dpkg --add-architecture $platform; done \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y build-essential \
|
&& apt-get install -y build-essential \
|
||||||
&& for platform in ${DEB_CROSSPLATFORMS}; do apt-get install -y crossbuild-essential-${platform}; done \
|
&& for platform in ${DEB_CROSSPLATFORMS}; do apt-get install -y crossbuild-essential-${platform}; done \
|
||||||
&& rm /etc/apt/sources.list.d/cgocrosscompiling.list \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install some required packages
|
# Install some required packages
|
||||||
@@ -41,11 +40,15 @@ RUN apt-get update \
|
|||||||
flex \
|
flex \
|
||||||
bison
|
bison
|
||||||
|
|
||||||
|
RUN curl -fsSLo shfmt https://github.com/mvdan/sh/releases/download/v1.3.0/shfmt_v1.3.0_linux_amd64 && \
|
||||||
|
echo "b1925c2c405458811f0c227266402cf1868b4de529f114722c2e3a5af4ac7bb2 shfmt" | sha256sum -c && \
|
||||||
|
chmod +x shfmt && \
|
||||||
|
mv shfmt /usr/bin
|
||||||
|
|
||||||
# Install common Go tools
|
# Install common Go tools
|
||||||
RUN go get \
|
RUN go get \
|
||||||
github.com/golang/lint/golint \
|
github.com/golang/lint/golint \
|
||||||
github.com/fzipp/gocyclo \
|
github.com/fzipp/gocyclo \
|
||||||
gopkg.in/mvdan/sh.v1/cmd/shfmt \
|
|
||||||
github.com/fatih/hclfmt \
|
github.com/fatih/hclfmt \
|
||||||
github.com/client9/misspell/cmd/misspell
|
github.com/client9/misspell/cmd/misspell
|
||||||
|
|
||||||
|
|||||||
+1
-11
@@ -11,7 +11,7 @@ machine:
|
|||||||
environment:
|
environment:
|
||||||
GOPATH: /home/ubuntu:$GOPATH
|
GOPATH: /home/ubuntu:$GOPATH
|
||||||
SRCDIR: /home/ubuntu/src/github.com/weaveworks/weave
|
SRCDIR: /home/ubuntu/src/github.com/weaveworks/weave
|
||||||
PATH: $PATH:$HOME/.local/bin
|
PATH: $PATH:$HOME/.local/bin:/opt/google-cloud-sdk/bin
|
||||||
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
|
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
|
||||||
STATE: /home/ubuntu/state.env
|
STATE: /home/ubuntu/state.env
|
||||||
# Base name of VMs for integration tests:
|
# Base name of VMs for integration tests:
|
||||||
@@ -59,18 +59,8 @@ teardown:
|
|||||||
parallel: true
|
parallel: true
|
||||||
|
|
||||||
deployment:
|
deployment:
|
||||||
release:
|
|
||||||
branch: /[0-9]+\.[0-9]+/
|
|
||||||
owner: weaveworks
|
|
||||||
commands:
|
|
||||||
- "$SRCDIR/bin/circle-deploy-release"
|
|
||||||
master:
|
master:
|
||||||
branch: master
|
branch: master
|
||||||
owner: weaveworks
|
owner: weaveworks
|
||||||
commands:
|
commands:
|
||||||
- "$SRCDIR/bin/circle-deploy-master"
|
- "$SRCDIR/bin/circle-deploy-master"
|
||||||
issues:
|
|
||||||
branch: /.*/
|
|
||||||
owner: weaveworks
|
|
||||||
commands:
|
|
||||||
- "$SRCDIR/bin/circle-deploy-issues"
|
|
||||||
@@ -77,8 +77,10 @@ iptables -A WEAVE-NPC -m state --state NEW -j WEAVE-NPC-INGRESS
|
|||||||
|
|
||||||
To direct traffic into the policy engine:
|
To direct traffic into the policy engine:
|
||||||
|
|
||||||
|
```
|
||||||
iptables -A FORWARD -o weave -m physdev ! --physdev-out vethwe-bridge -j WEAVE-NPC
|
iptables -A FORWARD -o weave -m physdev ! --physdev-out vethwe-bridge -j WEAVE-NPC
|
||||||
iptables -A FORWARD -o weave -m physdev ! --physdev-out vethwe-bridge -j DROP
|
iptables -A FORWARD -o weave -m physdev ! --physdev-out vethwe-bridge -j DROP
|
||||||
|
```
|
||||||
|
|
||||||
Note this only affects traffic which egresses the bridge on a physical
|
Note this only affects traffic which egresses the bridge on a physical
|
||||||
port which is not the Weave Net router - in other words, it is
|
port which is not the Weave Net router - in other words, it is
|
||||||
|
|||||||
+10
-2
@@ -210,9 +210,9 @@ func (alloc *Allocator) doOperation(op operation, ops *[]operation) {
|
|||||||
// already succeeded. If it is on the queue, we call
|
// already succeeded. If it is on the queue, we call
|
||||||
// cancel on it, allowing callers waiting for the resultChans
|
// cancel on it, allowing callers waiting for the resultChans
|
||||||
// to unblock.
|
// to unblock.
|
||||||
func (alloc *Allocator) cancelOp(op operation, ops *[]operation) {
|
func (alloc *Allocator) cancelOp(opToCancel operation, ops *[]operation) {
|
||||||
for i, op := range *ops {
|
for i, op := range *ops {
|
||||||
if op == op {
|
if op == opToCancel {
|
||||||
*ops = append((*ops)[:i], (*ops)[i+1:]...)
|
*ops = append((*ops)[:i], (*ops)[i+1:]...)
|
||||||
op.Cancel()
|
op.Cancel()
|
||||||
break
|
break
|
||||||
@@ -265,6 +265,10 @@ func (alloc *Allocator) tryPendingOps() {
|
|||||||
alloc.tryOps(&alloc.pendingAllocates)
|
alloc.tryOps(&alloc.pendingAllocates)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (alloc *Allocator) havePendingOps() bool {
|
||||||
|
return len(alloc.pendingPrimes)+len(alloc.pendingClaims)+len(alloc.pendingAllocates) > 0
|
||||||
|
}
|
||||||
|
|
||||||
func (alloc *Allocator) spaceRequestDenied(sender mesh.PeerName, r address.Range) {
|
func (alloc *Allocator) spaceRequestDenied(sender mesh.PeerName, r address.Range) {
|
||||||
for i := 0; i < len(alloc.pendingClaims); {
|
for i := 0; i < len(alloc.pendingClaims); {
|
||||||
claim := alloc.pendingClaims[i].(*claim)
|
claim := alloc.pendingClaims[i].(*claim)
|
||||||
@@ -696,9 +700,13 @@ func (alloc *Allocator) actorLoop(actionChan <-chan func(), stopChan <-chan stru
|
|||||||
// Retry things in case messages got lost between here and recipients
|
// Retry things in case messages got lost between here and recipients
|
||||||
if alloc.awaitingConsensus {
|
if alloc.awaitingConsensus {
|
||||||
alloc.propose()
|
alloc.propose()
|
||||||
|
} else if alloc.havePendingOps() {
|
||||||
|
if alloc.ring.Empty() {
|
||||||
|
alloc.establishRing()
|
||||||
} else {
|
} else {
|
||||||
alloc.tryPendingOps()
|
alloc.tryPendingOps()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
alloc.removeDeadContainers()
|
alloc.removeDeadContainers()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ func TestAllocatorClaim(t *testing.T) {
|
|||||||
alloc.Prime()
|
alloc.Prime()
|
||||||
// Do an allocate on the other peer, which we will try to claim later
|
// Do an allocate on the other peer, which we will try to claim later
|
||||||
addrx, err := allocs[0].Allocate(container1, subnet, true, returnFalse)
|
addrx, err := allocs[0].Allocate(container1, subnet, true, returnFalse)
|
||||||
|
require.NoError(t, err)
|
||||||
// Should not get the address we pre-claimed
|
// Should not get the address we pre-claimed
|
||||||
require.NotEqual(t, addrx, preAddr)
|
require.NotEqual(t, addrx, preAddr)
|
||||||
router.Flush()
|
router.Flush()
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ func TestLowlevel(t *testing.T) {
|
|||||||
|
|
||||||
s := New()
|
s := New()
|
||||||
require.Equal(t, address.Count(0), s.NumFreeAddresses())
|
require.Equal(t, address.Count(0), s.NumFreeAddresses())
|
||||||
ok, got := s.Allocate(address.NewRange(0, 1000))
|
ok, _ := s.Allocate(address.NewRange(0, 1000))
|
||||||
require.False(t, ok, "allocate in empty space should fail")
|
require.False(t, ok, "allocate in empty space should fail")
|
||||||
|
|
||||||
s.Add(100, 100)
|
s.Add(100, 100)
|
||||||
require.Equal(t, address.Count(100), s.NumFreeAddresses())
|
require.Equal(t, address.Count(100), s.NumFreeAddresses())
|
||||||
ok, got = s.Allocate(address.NewRange(0, 1000))
|
ok, got := s.Allocate(address.NewRange(0, 1000))
|
||||||
require.True(t, ok && got == 100, "allocate")
|
require.True(t, ok && got == 100, "allocate")
|
||||||
require.Equal(t, address.Count(99), s.NumFreeAddresses())
|
require.Equal(t, address.Count(99), s.NumFreeAddresses())
|
||||||
require.NoError(t, s.Claim(150))
|
require.NoError(t, s.Claim(150))
|
||||||
@@ -68,6 +68,7 @@ func TestLowlevel(t *testing.T) {
|
|||||||
wt.AssertErrorInterface(t, (*error)(nil), s.Free(100), "double free")
|
wt.AssertErrorInterface(t, (*error)(nil), s.Free(100), "double free")
|
||||||
|
|
||||||
r, ok := s.Donate(address.NewRange(0, 1000))
|
r, ok := s.Donate(address.NewRange(0, 1000))
|
||||||
|
require.True(t, ok, "donate")
|
||||||
require.Equal(t, address.NewRange(0xa0, 0x20), r, "donate")
|
require.Equal(t, address.NewRange(0xa0, 0x20), r, "donate")
|
||||||
|
|
||||||
// test Donate when addresses are scarce
|
// test Donate when addresses are scarce
|
||||||
@@ -78,6 +79,7 @@ func TestLowlevel(t *testing.T) {
|
|||||||
require.NoError(t, s.Claim(0))
|
require.NoError(t, s.Claim(0))
|
||||||
require.NoError(t, s.Claim(2))
|
require.NoError(t, s.Claim(2))
|
||||||
r, ok = s.Donate(address.NewRange(0, 1000))
|
r, ok = s.Donate(address.NewRange(0, 1000))
|
||||||
|
require.True(t, ok, "donate")
|
||||||
require.Equal(t, address.NewRange(1, 1), r, "donate")
|
require.Equal(t, address.NewRange(1, 1), r, "donate")
|
||||||
r, ok = s.Donate(address.NewRange(0, 1000))
|
r, ok = s.Donate(address.NewRange(0, 1000))
|
||||||
require.True(t, !ok, "donate should fail")
|
require.True(t, !ok, "donate should fail")
|
||||||
|
|||||||
+6
-2
@@ -113,7 +113,7 @@ func interfaceExistsInNamespace(netNSPath string, ifName string) bool {
|
|||||||
|
|
||||||
// NB: This function can be used only by a process that terminates immediately
|
// NB: This function can be used only by a process that terminates immediately
|
||||||
// after calling the function as it changes netns via WithNetNSLinkUnsafe.
|
// after calling the function as it changes netns via WithNetNSLinkUnsafe.
|
||||||
func AttachContainer(netNSPath, id, ifName, bridgeName string, mtu int, withMulticastRoute bool, cidrs []*net.IPNet, keepTXOn bool) error {
|
func AttachContainer(netNSPath, id, ifName, bridgeName string, mtu int, withMulticastRoute bool, cidrs []*net.IPNet, keepTXOn bool, hairpinMode bool) error {
|
||||||
ns, err := netns.GetFromPath(netNSPath)
|
ns, err := netns.GetFromPath(netNSPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -131,7 +131,7 @@ func AttachContainer(netNSPath, id, ifName, bridgeName string, mtu int, withMult
|
|||||||
id = id[:maxIDLen] // trim passed ID if too long
|
id = id[:maxIDLen] // trim passed ID if too long
|
||||||
}
|
}
|
||||||
name, peerName := vethPrefix+"pl"+id, vethPrefix+"pg"+id
|
name, peerName := vethPrefix+"pl"+id, vethPrefix+"pg"+id
|
||||||
_, err := CreateAndAttachVeth(name, peerName, bridgeName, mtu, keepTXOn, func(veth netlink.Link) error {
|
veth, err := CreateAndAttachVeth(name, peerName, bridgeName, mtu, keepTXOn, func(veth netlink.Link) error {
|
||||||
if err := netlink.LinkSetNsFd(veth, int(ns)); err != nil {
|
if err := netlink.LinkSetNsFd(veth, int(ns)); err != nil {
|
||||||
return fmt.Errorf("failed to move veth to container netns: %s", err)
|
return fmt.Errorf("failed to move veth to container netns: %s", err)
|
||||||
}
|
}
|
||||||
@@ -143,6 +143,10 @@ func AttachContainer(netNSPath, id, ifName, bridgeName string, mtu int, withMult
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err = netlink.LinkSetHairpin(veth, hairpinMode); err != nil {
|
||||||
|
return fmt.Errorf("unable to set hairpin mode to %t for bridge side of veth %s: %s", hairpinMode, name, err)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := WithNetNSLinkUnsafe(ns, ifName, func(veth netlink.Link) error {
|
if err := WithNetNSLinkUnsafe(ns, ifName, func(veth netlink.Link) error {
|
||||||
|
|||||||
@@ -6,4 +6,8 @@ const (
|
|||||||
MainChain = "WEAVE-NPC"
|
MainChain = "WEAVE-NPC"
|
||||||
DefaultChain = "WEAVE-NPC-DEFAULT"
|
DefaultChain = "WEAVE-NPC-DEFAULT"
|
||||||
IngressChain = "WEAVE-NPC-INGRESS"
|
IngressChain = "WEAVE-NPC-INGRESS"
|
||||||
|
|
||||||
|
IpsetNamePrefix = "weave-"
|
||||||
|
|
||||||
|
LocalIpset = IpsetNamePrefix + "local-pods"
|
||||||
)
|
)
|
||||||
+22
-1
@@ -29,6 +29,8 @@ type NetworkPolicyController interface {
|
|||||||
type controller struct {
|
type controller struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
|
|
||||||
|
nodeName string // my node name
|
||||||
|
|
||||||
ipt *iptables.IPTables
|
ipt *iptables.IPTables
|
||||||
ips ipset.Interface
|
ips ipset.Interface
|
||||||
|
|
||||||
@@ -36,8 +38,9 @@ type controller struct {
|
|||||||
nsSelectors *selectorSet // selector string -> nsSelector
|
nsSelectors *selectorSet // selector string -> nsSelector
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(ipt *iptables.IPTables, ips ipset.Interface) NetworkPolicyController {
|
func New(nodeName string, ipt *iptables.IPTables, ips ipset.Interface) NetworkPolicyController {
|
||||||
c := &controller{
|
c := &controller{
|
||||||
|
nodeName: nodeName,
|
||||||
ipt: ipt,
|
ipt: ipt,
|
||||||
ips: ips,
|
ips: ips,
|
||||||
nss: make(map[string]*ns)}
|
nss: make(map[string]*ns)}
|
||||||
@@ -82,10 +85,21 @@ func (npc *controller) withNS(name string, f func(ns *ns) error) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (npc *controller) checkLocalPod(obj *coreapi.Pod, event string) bool {
|
||||||
|
if obj.Spec.NodeName != npc.nodeName {
|
||||||
|
common.Log.Debugf("%s ignored for pod %s/%s on node %s", event, obj.ObjectMeta.Namespace, obj.ObjectMeta.Name, obj.Spec.NodeName)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (npc *controller) AddPod(obj *coreapi.Pod) error {
|
func (npc *controller) AddPod(obj *coreapi.Pod) error {
|
||||||
npc.Lock()
|
npc.Lock()
|
||||||
defer npc.Unlock()
|
defer npc.Unlock()
|
||||||
|
|
||||||
|
if !npc.checkLocalPod(obj, "AddPod") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
common.Log.Debugf("EVENT AddPod %s", js(obj))
|
common.Log.Debugf("EVENT AddPod %s", js(obj))
|
||||||
return npc.withNS(obj.ObjectMeta.Namespace, func(ns *ns) error {
|
return npc.withNS(obj.ObjectMeta.Namespace, func(ns *ns) error {
|
||||||
return errors.Wrap(ns.addPod(obj), "add pod")
|
return errors.Wrap(ns.addPod(obj), "add pod")
|
||||||
@@ -96,6 +110,10 @@ func (npc *controller) UpdatePod(oldObj, newObj *coreapi.Pod) error {
|
|||||||
npc.Lock()
|
npc.Lock()
|
||||||
defer npc.Unlock()
|
defer npc.Unlock()
|
||||||
|
|
||||||
|
// Pods don't move across nodes so we only check the new version
|
||||||
|
if !npc.checkLocalPod(newObj, "UpdatePod") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
common.Log.Debugf("EVENT UpdatePod %s %s", js(oldObj), js(newObj))
|
common.Log.Debugf("EVENT UpdatePod %s %s", js(oldObj), js(newObj))
|
||||||
return npc.withNS(oldObj.ObjectMeta.Namespace, func(ns *ns) error {
|
return npc.withNS(oldObj.ObjectMeta.Namespace, func(ns *ns) error {
|
||||||
return errors.Wrap(ns.updatePod(oldObj, newObj), "update pod")
|
return errors.Wrap(ns.updatePod(oldObj, newObj), "update pod")
|
||||||
@@ -106,6 +124,9 @@ func (npc *controller) DeletePod(obj *coreapi.Pod) error {
|
|||||||
npc.Lock()
|
npc.Lock()
|
||||||
defer npc.Unlock()
|
defer npc.Unlock()
|
||||||
|
|
||||||
|
if !npc.checkLocalPod(obj, "DeletePod") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
common.Log.Debugf("EVENT DeletePod %s", js(obj))
|
common.Log.Debugf("EVENT DeletePod %s", js(obj))
|
||||||
return npc.withNS(obj.ObjectMeta.Namespace, func(ns *ns) error {
|
return npc.withNS(obj.ObjectMeta.Namespace, func(ns *ns) error {
|
||||||
return errors.Wrap(ns.deletePod(obj), "delete pod")
|
return errors.Wrap(ns.deletePod(obj), "delete pod")
|
||||||
|
|||||||
+27
-2
@@ -1,7 +1,9 @@
|
|||||||
package ipset
|
package ipset
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
@@ -22,16 +24,19 @@ type Interface interface {
|
|||||||
Flush(ipsetName Name) error
|
Flush(ipsetName Name) error
|
||||||
Destroy(ipsetName Name) error
|
Destroy(ipsetName Name) error
|
||||||
|
|
||||||
|
List(prefix string) ([]Name, error)
|
||||||
|
|
||||||
FlushAll() error
|
FlushAll() error
|
||||||
DestroyAll() error
|
DestroyAll() error
|
||||||
}
|
}
|
||||||
|
|
||||||
type ipset struct {
|
type ipset struct {
|
||||||
refCount
|
refCount
|
||||||
|
*log.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() Interface {
|
func New(logger *log.Logger) Interface {
|
||||||
return &ipset{refCount: newRefCount()}
|
return &ipset{refCount: newRefCount(), Logger: logger}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) Create(ipsetName Name, ipsetType Type) error {
|
func (i *ipset) Create(ipsetName Name, ipsetType Type) error {
|
||||||
@@ -39,6 +44,7 @@ func (i *ipset) Create(ipsetName Name, ipsetType Type) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) AddEntry(ipsetName Name, entry string) error {
|
func (i *ipset) AddEntry(ipsetName Name, entry string) error {
|
||||||
|
i.Logger.Printf("adding entry %s to %s", entry, ipsetName)
|
||||||
if i.inc(ipsetName, entry) > 1 { // already in the set
|
if i.inc(ipsetName, entry) > 1 { // already in the set
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -46,6 +52,7 @@ func (i *ipset) AddEntry(ipsetName Name, entry string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) DelEntry(ipsetName Name, entry string) error {
|
func (i *ipset) DelEntry(ipsetName Name, entry string) error {
|
||||||
|
i.Logger.Printf("deleting entry %s from %s", entry, ipsetName)
|
||||||
if i.dec(ipsetName, entry) > 0 { // still needed
|
if i.dec(ipsetName, entry) > 0 { // still needed
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -72,6 +79,24 @@ func (i *ipset) DestroyAll() error {
|
|||||||
return doExec("destroy")
|
return doExec("destroy")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fetch a list of all existing sets with a given prefix
|
||||||
|
func (i *ipset) List(prefix string) ([]Name, error) {
|
||||||
|
output, err := exec.Command("ipset", "list", "-name", "-output", "plain").Output()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var selected []Name
|
||||||
|
sets := strings.Split(string(output), "\n")
|
||||||
|
for _, v := range sets {
|
||||||
|
if strings.HasPrefix(v, prefix) {
|
||||||
|
selected = append(selected, Name(v))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return selected, err
|
||||||
|
}
|
||||||
|
|
||||||
func doExec(args ...string) error {
|
func doExec(args ...string) error {
|
||||||
if output, err := exec.Command("ipset", args...).CombinedOutput(); err != nil {
|
if output, err := exec.Command("ipset", args...).CombinedOutput(); err != nil {
|
||||||
return errors.Wrapf(err, "ipset %v failed: %s", args, output)
|
return errors.Wrapf(err, "ipset %v failed: %s", args, output)
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ func (ns *ns) addPod(obj *coreapi.Pod) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ns.ips.AddEntry(LocalIpset, obj.Status.PodIP)
|
||||||
return ns.podSelectors.addToMatching(obj.ObjectMeta.Labels, obj.Status.PodIP)
|
return ns.podSelectors.addToMatching(obj.ObjectMeta.Labels, obj.Status.PodIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,10 +101,12 @@ func (ns *ns) updatePod(oldObj, newObj *coreapi.Pod) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if hasIP(oldObj) && !hasIP(newObj) {
|
if hasIP(oldObj) && !hasIP(newObj) {
|
||||||
|
ns.ips.DelEntry(LocalIpset, oldObj.Status.PodIP)
|
||||||
return ns.podSelectors.delFromMatching(oldObj.ObjectMeta.Labels, oldObj.Status.PodIP)
|
return ns.podSelectors.delFromMatching(oldObj.ObjectMeta.Labels, oldObj.Status.PodIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !hasIP(oldObj) && hasIP(newObj) {
|
if !hasIP(oldObj) && hasIP(newObj) {
|
||||||
|
ns.ips.AddEntry(LocalIpset, newObj.Status.PodIP)
|
||||||
return ns.podSelectors.addToMatching(newObj.ObjectMeta.Labels, newObj.Status.PodIP)
|
return ns.podSelectors.addToMatching(newObj.ObjectMeta.Labels, newObj.Status.PodIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +142,7 @@ func (ns *ns) deletePod(obj *coreapi.Pod) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ns.ips.DelEntry(LocalIpset, obj.Status.PodIP)
|
||||||
return ns.podSelectors.delFromMatching(obj.ObjectMeta.Labels, obj.Status.PodIP)
|
return ns.podSelectors.delFromMatching(obj.ObjectMeta.Labels, obj.Status.PodIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -29,7 +29,7 @@ func newSelectorSpec(json *unversioned.LabelSelector, nsName string, ipsetType i
|
|||||||
// We prefix the selector string with the namespace name when generating
|
// We prefix the selector string with the namespace name when generating
|
||||||
// the shortname because you can specify the same selector in multiple
|
// the shortname because you can specify the same selector in multiple
|
||||||
// namespaces - we need those to map to distinct ipsets
|
// namespaces - we need those to map to distinct ipsets
|
||||||
ipsetName: ipset.Name("weave-" + shortName(nsName+":"+key)),
|
ipsetName: ipset.Name(IpsetNamePrefix + shortName(nsName+":"+key)),
|
||||||
ipsetType: ipsetType}, nil
|
ipsetType: ipsetType}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,12 +43,10 @@ func (s *selector) matches(labelMap map[string]string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *selector) addEntry(entry string) error {
|
func (s *selector) addEntry(entry string) error {
|
||||||
common.Log.Infof("adding entry %s to %s", entry, s.spec.ipsetName)
|
|
||||||
return s.ips.AddEntry(s.spec.ipsetName, entry)
|
return s.ips.AddEntry(s.spec.ipsetName, entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *selector) delEntry(entry string) error {
|
func (s *selector) delEntry(entry string) error {
|
||||||
common.Log.Infof("deleting entry %s from %s", entry, s.spec.ipsetName)
|
|
||||||
return s.ips.DelEntry(s.spec.ipsetName, entry)
|
return s.ips.DelEntry(s.spec.ipsetName, entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -7,12 +7,13 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// This array:
|
// This array:
|
||||||
// * Must include only printable UTF8 characters that are represented with a single byte
|
// * Must include only printable UTF8 characters that are represented with a single byte (http://www.utf8-chartable.de/)
|
||||||
// * Must be at least of length 85 (`len("weave-") + l(2^160)/l(85)` equals 31, the maximum ipset name length)
|
// * Must be at least of length 85 (`len("weave-") + l(2^160)/l(85)` equals 31, the maximum ipset name length)
|
||||||
// * Must not include commas as those are treated specially by `ipset add` when adding a named set to a list:set
|
// * Must not include commas as those are treated specially by `ipset add` when adding a named set to a list:set
|
||||||
// * Should not include space for readability
|
// * Should not include space for readability
|
||||||
|
// * Should not include invalid chars for XML `<>&"'`
|
||||||
// * Should not include single quote or backslash to be nice to shell users
|
// * Should not include single quote or backslash to be nice to shell users
|
||||||
ShortNameSymbols = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789(){}[]<>_$%^&*|/?.;:@#~"
|
ShortNameSymbols = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789(){}[]+=_$%^!*|/?.;:@#~"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sha1 hash an arbitrary string and represent it using the full range of
|
// sha1 hash an arbitrary string and represent it using the full range of
|
||||||
|
|||||||
+15
-9
@@ -5,19 +5,24 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/appc/cni/pkg/skel"
|
"github.com/containernetworking/cni/pkg/skel"
|
||||||
"github.com/appc/cni/pkg/types"
|
"github.com/containernetworking/cni/pkg/types"
|
||||||
|
"github.com/containernetworking/cni/pkg/types/current"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (i *Ipam) CmdAdd(args *skel.CmdArgs) error {
|
func (i *Ipam) CmdAdd(args *skel.CmdArgs) error {
|
||||||
|
var conf types.NetConf
|
||||||
|
if err := json.Unmarshal(args.StdinData, &conf); err != nil {
|
||||||
|
return fmt.Errorf("failed to load netconf: %v", err)
|
||||||
|
}
|
||||||
result, err := i.Allocate(args)
|
result, err := i.Allocate(args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return result.Print()
|
return types.PrintResult(result, conf.CNIVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Ipam) Allocate(args *skel.CmdArgs) (*types.Result, error) {
|
func (i *Ipam) Allocate(args *skel.CmdArgs) (types.Result, error) {
|
||||||
// extract the things we care about
|
// extract the things we care about
|
||||||
conf, err := loadIPAMConf(args.StdinData)
|
conf, err := loadIPAMConf(args.StdinData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -46,12 +51,13 @@ func (i *Ipam) Allocate(args *skel.CmdArgs) (*types.Result, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result := &types.Result{
|
result := ¤t.Result{
|
||||||
IP4: &types.IPConfig{
|
IPs: []*current.IPConfig{{
|
||||||
IP: *ipnet,
|
Version: "4",
|
||||||
|
Address: *ipnet,
|
||||||
Gateway: conf.Gateway,
|
Gateway: conf.Gateway,
|
||||||
|
}},
|
||||||
Routes: conf.Routes,
|
Routes: conf.Routes,
|
||||||
},
|
|
||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
@@ -67,7 +73,7 @@ func (i *Ipam) Release(args *skel.CmdArgs) error {
|
|||||||
type ipamConf struct {
|
type ipamConf struct {
|
||||||
Subnet string `json:"subnet,omitempty"`
|
Subnet string `json:"subnet,omitempty"`
|
||||||
Gateway net.IP `json:"gateway,omitempty"`
|
Gateway net.IP `json:"gateway,omitempty"`
|
||||||
Routes []types.Route `json:"routes"`
|
Routes []*types.Route `json:"routes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type netConf struct {
|
type netConf struct {
|
||||||
|
|||||||
+54
-22
@@ -5,11 +5,13 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/appc/cni/pkg/ipam"
|
"github.com/containernetworking/cni/pkg/ipam"
|
||||||
"github.com/appc/cni/pkg/skel"
|
"github.com/containernetworking/cni/pkg/skel"
|
||||||
"github.com/appc/cni/pkg/types"
|
"github.com/containernetworking/cni/pkg/types"
|
||||||
|
"github.com/containernetworking/cni/pkg/types/current"
|
||||||
"github.com/vishvananda/netlink"
|
"github.com/vishvananda/netlink"
|
||||||
"github.com/vishvananda/netns"
|
"github.com/vishvananda/netns"
|
||||||
weaveapi "github.com/weaveworks/weave/api"
|
weaveapi "github.com/weaveworks/weave/api"
|
||||||
@@ -33,6 +35,7 @@ func NewCNIPlugin(weave *weaveapi.Client) *CNIPlugin {
|
|||||||
func loadNetConf(bytes []byte) (*NetConf, error) {
|
func loadNetConf(bytes []byte) (*NetConf, error) {
|
||||||
n := &NetConf{
|
n := &NetConf{
|
||||||
BrName: weavenet.WeaveBridgeName,
|
BrName: weavenet.WeaveBridgeName,
|
||||||
|
HairpinMode: true,
|
||||||
}
|
}
|
||||||
if err := json.Unmarshal(bytes, n); err != nil {
|
if err := json.Unmarshal(bytes, n); err != nil {
|
||||||
return nil, fmt.Errorf("failed to load netconf: %v", err)
|
return nil, fmt.Errorf("failed to load netconf: %v", err)
|
||||||
@@ -40,17 +43,26 @@ func loadNetConf(bytes []byte) (*NetConf, error) {
|
|||||||
return n, nil
|
return n, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CNIPlugin) getIP(ipamType string, args *skel.CmdArgs) (result *types.Result, err error) {
|
func (c *CNIPlugin) getIP(ipamType string, args *skel.CmdArgs) (newResult *current.Result, err error) {
|
||||||
|
var result types.Result
|
||||||
// Default IPAM is Weave's own
|
// Default IPAM is Weave's own
|
||||||
if ipamType == "" {
|
if ipamType == "" {
|
||||||
result, err = ipamplugin.NewIpam(c.weave).Allocate(args)
|
result, err = ipamplugin.NewIpam(c.weave).Allocate(args)
|
||||||
} else {
|
} else {
|
||||||
result, err = ipam.ExecAdd(ipamType, args.StdinData)
|
result, err = ipam.ExecAdd(ipamType, args.StdinData)
|
||||||
}
|
}
|
||||||
if err == nil && result.IP4 == nil {
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if result == nil {
|
||||||
|
return nil, fmt.Errorf("Received no usable result from IPAM plugin")
|
||||||
|
}
|
||||||
|
newResult, err = current.NewResultFromResult(result)
|
||||||
|
// Check if ipam returned no results without error
|
||||||
|
if err == nil && len(newResult.IPs) == 0 {
|
||||||
return nil, fmt.Errorf("IPAM plugin failed to allocate IP address")
|
return nil, fmt.Errorf("IPAM plugin failed to allocate IP address")
|
||||||
}
|
}
|
||||||
return result, err
|
return newResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CNIPlugin) CmdAdd(args *skel.CmdArgs) error {
|
func (c *CNIPlugin) CmdAdd(args *skel.CmdArgs) error {
|
||||||
@@ -70,28 +82,35 @@ func (c *CNIPlugin) CmdAdd(args *skel.CmdArgs) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to allocate IP address: %s", err)
|
return fmt.Errorf("unable to allocate IP address: %s", err)
|
||||||
}
|
}
|
||||||
|
// Only expecting one address
|
||||||
|
ip := result.IPs[0]
|
||||||
|
|
||||||
// If config says nothing about routes or gateway, default one will be via the bridge
|
// If config says nothing about routes or gateway, default one will be via the bridge
|
||||||
if result.IP4.Routes == nil && result.IP4.Gateway == nil {
|
if len(result.Routes) == 0 && ip.Gateway == nil {
|
||||||
bridgeIP, err := weavenet.FindBridgeIP(conf.BrName, &result.IP4.IP)
|
bridgeIP, err := weavenet.FindBridgeIP(conf.BrName, &ip.Address)
|
||||||
if err == weavenet.ErrBridgeNoIP {
|
if err == weavenet.ErrBridgeNoIP {
|
||||||
bridgeArgs := *args
|
bridgeArgs := *args
|
||||||
bridgeArgs.ContainerID = "weave:expose"
|
bridgeArgs.ContainerID = "weave:expose"
|
||||||
|
// It would be better if libcni let us send just the desired parameters,
|
||||||
|
// but there is a bug: https://github.com/containernetworking/cni/issues/410
|
||||||
|
// so just blank out the one we want to change
|
||||||
|
os.Setenv("CNI_CONTAINERID", bridgeArgs.ContainerID)
|
||||||
bridgeIPResult, err := c.getIP(conf.IPAM.Type, &bridgeArgs)
|
bridgeIPResult, err := c.getIP(conf.IPAM.Type, &bridgeArgs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to allocate IP address for bridge: %s", err)
|
return fmt.Errorf("unable to allocate IP address for bridge: %s", err)
|
||||||
}
|
}
|
||||||
if err := assignBridgeIP(conf.BrName, bridgeIPResult.IP4.IP); err != nil {
|
bridgeCIDR := bridgeIPResult.IPs[0].Address
|
||||||
|
if err := assignBridgeIP(conf.BrName, bridgeCIDR); err != nil {
|
||||||
return fmt.Errorf("unable to assign IP address to bridge: %s", err)
|
return fmt.Errorf("unable to assign IP address to bridge: %s", err)
|
||||||
}
|
}
|
||||||
if err := weavenet.ExposeNAT(bridgeIPResult.IP4.IP); err != nil {
|
if err := weavenet.ExposeNAT(bridgeCIDR); err != nil {
|
||||||
return fmt.Errorf("unable to create NAT rules: %s", err)
|
return fmt.Errorf("unable to create NAT rules: %s", err)
|
||||||
}
|
}
|
||||||
bridgeIP = bridgeIPResult.IP4.IP.IP
|
bridgeIP = bridgeCIDR.IP
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
result.IP4.Gateway = bridgeIP
|
result.IPs[0].Gateway = bridgeIP
|
||||||
}
|
}
|
||||||
|
|
||||||
ns, err := netns.GetFromPath(args.Netns)
|
ns, err := netns.GetFromPath(args.Netns)
|
||||||
@@ -110,20 +129,20 @@ func (c *CNIPlugin) CmdAdd(args *skel.CmdArgs) error {
|
|||||||
id = fmt.Sprintf("%x", data)
|
id = fmt.Sprintf("%x", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := weavenet.AttachContainer(args.Netns, id, args.IfName, conf.BrName, conf.MTU, false, []*net.IPNet{&result.IP4.IP}, false); err != nil {
|
if err := weavenet.AttachContainer(args.Netns, id, args.IfName, conf.BrName, conf.MTU, false, []*net.IPNet{&ip.Address}, false, conf.HairpinMode); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := weavenet.WithNetNSLinkUnsafe(ns, args.IfName, func(link netlink.Link) error {
|
if err := weavenet.WithNetNSLinkUnsafe(ns, args.IfName, func(link netlink.Link) error {
|
||||||
return setupRoutes(link, args.IfName, result.IP4.IP, result.IP4.Gateway, result.IP4.Routes)
|
return setupRoutes(link, args.IfName, ip.Address, ip.Gateway, result.Routes)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("error setting up routes: %s", err)
|
return fmt.Errorf("error setting up routes: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
result.DNS = conf.DNS
|
result.DNS = conf.DNS
|
||||||
return result.Print()
|
return types.PrintResult(result, conf.CNIVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupRoutes(link netlink.Link, name string, ipnet net.IPNet, gw net.IP, routes []types.Route) error {
|
func setupRoutes(link netlink.Link, name string, ipnet net.IPNet, gw net.IP, routes []*types.Route) error {
|
||||||
var err error
|
var err error
|
||||||
if routes == nil { // If config says nothing about routes, add a default one
|
if routes == nil { // If config says nothing about routes, add a default one
|
||||||
if !ipnet.Contains(gw) {
|
if !ipnet.Contains(gw) {
|
||||||
@@ -133,7 +152,7 @@ func setupRoutes(link netlink.Link, name string, ipnet net.IPNet, gw net.IP, rou
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
routes = []types.Route{{Dst: zeroNetwork}}
|
routes = []*types.Route{{Dst: zeroNetwork}}
|
||||||
}
|
}
|
||||||
for _, r := range routes {
|
for _, r := range routes {
|
||||||
if r.GW != nil {
|
if r.GW != nil {
|
||||||
@@ -164,14 +183,22 @@ func assignBridgeIP(bridgeName string, ipnet net.IPNet) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// As of CNI 0.5 spec:
|
||||||
|
// "Plugins should generally complete a DEL action without error even if some resources are missing"
|
||||||
|
// this method should therefore return nil in most, if not all, cases.
|
||||||
func (c *CNIPlugin) CmdDel(args *skel.CmdArgs) error {
|
func (c *CNIPlugin) CmdDel(args *skel.CmdArgs) error {
|
||||||
conf, err := loadNetConf(args.StdinData)
|
conf, err := loadNetConf(args.StdinData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
logOnStderr(err)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// As of CNI 0.3 spec, runtimes can send blank if they just want the address deallocated
|
||||||
|
if args.Netns != "" {
|
||||||
if _, err = weavenet.WithNetNS(args.Netns, "del-iface", args.IfName); err != nil {
|
if _, err = weavenet.WithNetNS(args.Netns, "del-iface", args.IfName); err != nil {
|
||||||
return fmt.Errorf("error removing interface %q: %s", args.IfName, err)
|
// We log the error and carry on instead of returning nil, as there may still be resources to free in IPAM.
|
||||||
|
logOnStderr(fmt.Errorf("error removing interface %q: %s", args.IfName, err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default IPAM is Weave's own
|
// Default IPAM is Weave's own
|
||||||
@@ -180,16 +207,21 @@ func (c *CNIPlugin) CmdDel(args *skel.CmdArgs) error {
|
|||||||
} else {
|
} else {
|
||||||
err = ipam.ExecDel(conf.IPAM.Type, args.StdinData)
|
err = ipam.ExecDel(conf.IPAM.Type, args.StdinData)
|
||||||
}
|
}
|
||||||
if err != nil {
|
logOnStderr(fmt.Errorf("unable to release IP address: %s", err))
|
||||||
return fmt.Errorf("unable to release IP address: %s", err)
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Standard error is inherited from the caller (e.g. Kubelet, when running Weave Net's CNI plugin
|
||||||
|
// under Kubernetes) hence provided errors should eventually appear in the caller's log files.
|
||||||
|
func logOnStderr(err error) {
|
||||||
|
fmt.Fprintln(os.Stderr, "weave-cni:", err)
|
||||||
|
}
|
||||||
|
|
||||||
type NetConf struct {
|
type NetConf struct {
|
||||||
types.NetConf
|
types.NetConf
|
||||||
BrName string `json:"bridge"`
|
BrName string `json:"bridge"`
|
||||||
IsGW bool `json:"isGateway"`
|
IsGW bool `json:"isGateway"`
|
||||||
IPMasq bool `json:"ipMasq"`
|
IPMasq bool `json:"ipMasq"`
|
||||||
MTU int `json:"mtu"`
|
MTU int `json:"mtu"`
|
||||||
|
HairpinMode bool `json:"hairpinMode"`
|
||||||
}
|
}
|
||||||
+18
-2
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"net"
|
||||||
|
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
api "k8s.io/client-go/pkg/api/v1"
|
api "k8s.io/client-go/pkg/api/v1"
|
||||||
@@ -35,10 +36,25 @@ func getKubePeers() ([]string, error) {
|
|||||||
}
|
}
|
||||||
addresses := make([]string, 0, len(nodeList.Items))
|
addresses := make([]string, 0, len(nodeList.Items))
|
||||||
for _, peer := range nodeList.Items {
|
for _, peer := range nodeList.Items {
|
||||||
|
var internalIP, externalIP string
|
||||||
for _, addr := range peer.Status.Addresses {
|
for _, addr := range peer.Status.Addresses {
|
||||||
if addr.Type == "InternalIP" {
|
// Check it's a valid ipv4 address
|
||||||
addresses = append(addresses, addr.Address)
|
ip := net.ParseIP(addr.Address)
|
||||||
|
if ip == nil || ip.To4() == nil {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
if addr.Type == "InternalIP" {
|
||||||
|
internalIP = ip.To4().String()
|
||||||
|
} else if addr.Type == "ExternalIP" {
|
||||||
|
externalIP = ip.To4().String()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback for cases where a Node has an ExternalIP but no InternalIP
|
||||||
|
if internalIP != "" {
|
||||||
|
addresses = append(addresses, internalIP)
|
||||||
|
} else if externalIP != "" {
|
||||||
|
addresses = append(addresses, externalIP)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return addresses, nil
|
return addresses, nil
|
||||||
|
|||||||
+1
-1
@@ -94,7 +94,7 @@ func run(dockerClient *docker.Client, weave *weaveapi.Client, address, meshAddre
|
|||||||
}
|
}
|
||||||
go serveStatus(statusListener)
|
go serveStatus(statusListener)
|
||||||
sigChan := make(chan os.Signal, 1)
|
sigChan := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigChan, os.Interrupt, os.Kill, syscall.SIGTERM)
|
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case sig := <-sigChan:
|
case sig := <-sigChan:
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ modprobe_safe() {
|
|||||||
|
|
||||||
# Check whether xt_set actually exists
|
# Check whether xt_set actually exists
|
||||||
xt_set_exists() {
|
xt_set_exists() {
|
||||||
|
# Clean everything up in advance, in case there's leftovers
|
||||||
|
iptables -F WEAVE-KUBE-TEST 2>/dev/null || true
|
||||||
|
iptables -X WEAVE-KUBE-TEST 2>/dev/null || true
|
||||||
|
ipset destroy weave-kube-test 2>/dev/null || true
|
||||||
|
|
||||||
ipset create weave-kube-test hash:ip
|
ipset create weave-kube-test hash:ip
|
||||||
iptables -t filter -N WEAVE-KUBE-TEST
|
iptables -t filter -N WEAVE-KUBE-TEST
|
||||||
if ! iptables -A WEAVE-KUBE-TEST -m set --match-set weave-kube-test src -j DROP; then
|
if ! iptables -A WEAVE-KUBE-TEST -m set --match-set weave-kube-test src -j DROP; then
|
||||||
@@ -117,7 +122,7 @@ post_start_actions() {
|
|||||||
|
|
||||||
post_start_actions &
|
post_start_actions &
|
||||||
|
|
||||||
exec /home/weave/weaver $EXTRA_ARGS --port=6783 $BRIDGE_OPTIONS \
|
/home/weave/weaver $EXTRA_ARGS --port=6783 $BRIDGE_OPTIONS \
|
||||||
--http-addr=$HTTP_ADDR --status-addr=$STATUS_ADDR --docker-api='' --no-dns \
|
--http-addr=$HTTP_ADDR --status-addr=$STATUS_ADDR --docker-api='' --no-dns \
|
||||||
--ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \
|
--ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \
|
||||||
--ipalloc-init $IPALLOC_INIT \
|
--ipalloc-init $IPALLOC_INIT \
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
kind: ClusterRole
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
|
metadata:
|
||||||
|
name: weave-net
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- pods
|
||||||
|
- namespaces
|
||||||
|
- nodes
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- extensions
|
||||||
|
resources:
|
||||||
|
- networkpolicies
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: weave-net
|
||||||
|
namespace: kube-system
|
||||||
|
---
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
|
metadata:
|
||||||
|
name: weave-net
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: weave-net
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: weave-net
|
||||||
|
namespace: kube-system
|
||||||
|
---
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: DaemonSet
|
||||||
|
metadata:
|
||||||
|
name: weave-net
|
||||||
|
namespace: kube-system
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
name: weave-net
|
||||||
|
spec:
|
||||||
|
hostNetwork: true
|
||||||
|
hostPID: true
|
||||||
|
containers:
|
||||||
|
- name: weave
|
||||||
|
image: weaveworks/weave-kube:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
command:
|
||||||
|
- /home/weave/launch.sh
|
||||||
|
livenessProbe:
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
httpGet:
|
||||||
|
host: 127.0.0.1
|
||||||
|
path: /status
|
||||||
|
port: 6784
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- name: weavedb
|
||||||
|
mountPath: /weavedb
|
||||||
|
- name: cni-bin
|
||||||
|
mountPath: /host/opt
|
||||||
|
- name: cni-bin2
|
||||||
|
mountPath: /host/home
|
||||||
|
- name: cni-conf
|
||||||
|
mountPath: /host/etc
|
||||||
|
- name: dbus
|
||||||
|
mountPath: /host/var/lib/dbus
|
||||||
|
- name: lib-modules
|
||||||
|
mountPath: /lib/modules
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
- name: weave-npc
|
||||||
|
image: weaveworks/weave-npc:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
env:
|
||||||
|
- name: HOSTNAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
apiVersion: v1
|
||||||
|
fieldPath: spec.nodeName
|
||||||
|
restartPolicy: Always
|
||||||
|
tolerations:
|
||||||
|
- key: node-role.kubernetes.io/master
|
||||||
|
effect: NoSchedule
|
||||||
|
serviceAccountName: weave-net
|
||||||
|
securityContext:
|
||||||
|
seLinuxOptions:
|
||||||
|
type: spc_t
|
||||||
|
volumes:
|
||||||
|
- name: weavedb
|
||||||
|
emptyDir: {}
|
||||||
|
- name: cni-bin
|
||||||
|
hostPath:
|
||||||
|
path: /opt
|
||||||
|
- name: cni-bin2
|
||||||
|
hostPath:
|
||||||
|
path: /home
|
||||||
|
- name: cni-conf
|
||||||
|
hostPath:
|
||||||
|
path: /etc
|
||||||
|
- name: dbus
|
||||||
|
hostPath:
|
||||||
|
path: /var/lib/dbus
|
||||||
|
- name: lib-modules
|
||||||
|
hostPath:
|
||||||
|
path: /lib/modules
|
||||||
@@ -59,6 +59,12 @@ spec:
|
|||||||
cpu: 10m
|
cpu: 10m
|
||||||
securityContext:
|
securityContext:
|
||||||
privileged: true
|
privileged: true
|
||||||
|
env:
|
||||||
|
- name: HOSTNAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
apiVersion: v1
|
||||||
|
fieldPath: spec.nodeName
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
volumes:
|
volumes:
|
||||||
- name: weavedb
|
- name: weavedb
|
||||||
|
|||||||
+53
-12
@@ -28,6 +28,7 @@ var (
|
|||||||
metricsAddr string
|
metricsAddr string
|
||||||
logLevel string
|
logLevel string
|
||||||
allowMcast bool
|
allowMcast bool
|
||||||
|
nodeName string
|
||||||
)
|
)
|
||||||
|
|
||||||
func handleError(err error) { common.CheckFatal(err) }
|
func handleError(err error) { common.CheckFatal(err) }
|
||||||
@@ -53,6 +54,41 @@ func resetIPTables(ipt *iptables.IPTables) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func resetIPSets(ips ipset.Interface) error {
|
||||||
|
// Remove ipsets prefixed `weave-` only
|
||||||
|
|
||||||
|
sets, err := ips.List(npc.IpsetNamePrefix)
|
||||||
|
if err != nil {
|
||||||
|
common.Log.Errorf("Failed to retrieve list of ipsets")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
common.Log.Debugf("Got list of ipsets: %v", sets)
|
||||||
|
|
||||||
|
// Must remove references to ipsets by other ipsets before they're destroyed
|
||||||
|
for _, s := range sets {
|
||||||
|
common.Log.Debugf("Flushing ipset '%s'", string(s))
|
||||||
|
if err := ips.Flush(s); err != nil {
|
||||||
|
common.Log.Errorf("Failed to flush ipset '%s'", string(s))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, s := range sets {
|
||||||
|
common.Log.Debugf("Destroying ipset '%s'", string(s))
|
||||||
|
if err := ips.Destroy(s); err != nil {
|
||||||
|
common.Log.Errorf("Failed to destroy ipset '%s'", string(s))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func createBaseRules(ipt *iptables.IPTables, ips ipset.Interface) error {
|
||||||
// Configure main chain static rules
|
// Configure main chain static rules
|
||||||
if err := ipt.Append(npc.TableFilter, npc.MainChain,
|
if err := ipt.Append(npc.TableFilter, npc.MainChain,
|
||||||
"-m", "state", "--state", "RELATED,ESTABLISHED", "-j", "ACCEPT"); err != nil {
|
"-m", "state", "--state", "RELATED,ESTABLISHED", "-j", "ACCEPT"); err != nil {
|
||||||
@@ -76,17 +112,13 @@ func resetIPTables(ipt *iptables.IPTables) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
// If the destination address is not any of the local pods, let it through
|
||||||
}
|
if err := ips.Create(npc.LocalIpset, ipset.HashIP); err != nil {
|
||||||
|
|
||||||
func resetIPSets(ips ipset.Interface) error {
|
|
||||||
// TODO should restrict ipset operations to the `weave-` prefix:
|
|
||||||
|
|
||||||
if err := ips.FlushAll(); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := ipt.Append(npc.TableFilter, npc.MainChain,
|
||||||
if err := ips.DestroyAll(); err != nil {
|
"-m", "set", "--match-set", npc.LocalIpset, "src",
|
||||||
|
"-m", "set", "!", "--match-set", npc.LocalIpset, "dst", "-j", "ACCEPT"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +127,14 @@ func resetIPSets(ips ipset.Interface) error {
|
|||||||
|
|
||||||
func root(cmd *cobra.Command, args []string) {
|
func root(cmd *cobra.Command, args []string) {
|
||||||
common.SetLogLevel(logLevel)
|
common.SetLogLevel(logLevel)
|
||||||
common.Log.Infof("Starting Weaveworks NPC %s", version)
|
if nodeName == "" {
|
||||||
|
// HOSTNAME is set by Kubernetes for pods in the host network namespace
|
||||||
|
nodeName = os.Getenv("HOSTNAME")
|
||||||
|
}
|
||||||
|
if nodeName == "" {
|
||||||
|
common.Log.Fatalf("Must set node name via --node-name or $HOSTNAME")
|
||||||
|
}
|
||||||
|
common.Log.Infof("Starting Weaveworks NPC %s; node name %q", version, nodeName)
|
||||||
|
|
||||||
if err := metrics.Start(metricsAddr); err != nil {
|
if err := metrics.Start(metricsAddr); err != nil {
|
||||||
common.Log.Fatalf("Failed to start metrics: %v", err)
|
common.Log.Fatalf("Failed to start metrics: %v", err)
|
||||||
@@ -114,12 +153,13 @@ func root(cmd *cobra.Command, args []string) {
|
|||||||
ipt, err := iptables.New()
|
ipt, err := iptables.New()
|
||||||
handleError(err)
|
handleError(err)
|
||||||
|
|
||||||
ips := ipset.New()
|
ips := ipset.New(common.LogLogger())
|
||||||
|
|
||||||
handleError(resetIPTables(ipt))
|
handleError(resetIPTables(ipt))
|
||||||
handleError(resetIPSets(ips))
|
handleError(resetIPSets(ips))
|
||||||
|
handleError(createBaseRules(ipt, ips))
|
||||||
|
|
||||||
npc := npc.New(ipt, ips)
|
npc := npc.New(nodeName, ipt, ips)
|
||||||
|
|
||||||
nsController := makeController(client.Core().RESTClient(), "namespaces", &coreapi.Namespace{},
|
nsController := makeController(client.Core().RESTClient(), "namespaces", &coreapi.Namespace{},
|
||||||
cache.ResourceEventHandlerFuncs{
|
cache.ResourceEventHandlerFuncs{
|
||||||
@@ -199,6 +239,7 @@ func main() {
|
|||||||
rootCmd.PersistentFlags().StringVar(&metricsAddr, "metrics-addr", ":6781", "metrics server bind address")
|
rootCmd.PersistentFlags().StringVar(&metricsAddr, "metrics-addr", ":6781", "metrics server bind address")
|
||||||
rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "debug", "logging level (debug, info, warning, error)")
|
rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "debug", "logging level (debug, info, warning, error)")
|
||||||
rootCmd.PersistentFlags().BoolVar(&allowMcast, "allow-mcast", true, "allow all multicast traffic")
|
rootCmd.PersistentFlags().BoolVar(&allowMcast, "allow-mcast", true, "allow all multicast traffic")
|
||||||
|
rootCmd.PersistentFlags().StringVar(&nodeName, "node-name", "", "only generate rules that apply to this node")
|
||||||
|
|
||||||
handleError(rootCmd.Execute())
|
handleError(rootCmd.Execute())
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/weaveworks/go-checkpoint"
|
"github.com/weaveworks/go-checkpoint"
|
||||||
|
weave "github.com/weaveworks/weave/router"
|
||||||
)
|
)
|
||||||
|
|
||||||
var checker *checkpoint.Checker
|
var checker *checkpoint.Checker
|
||||||
@@ -16,7 +17,7 @@ const (
|
|||||||
updateCheckPeriod = 6 * time.Hour
|
updateCheckPeriod = 6 * time.Hour
|
||||||
)
|
)
|
||||||
|
|
||||||
func checkForUpdates(dockerVersion string, network string) {
|
func checkForUpdates(dockerVersion string, router *weave.NetworkRouter) {
|
||||||
newVersion.Store("")
|
newVersion.Store("")
|
||||||
success.Store(true)
|
success.Store(true)
|
||||||
|
|
||||||
@@ -51,9 +52,6 @@ func checkForUpdates(dockerVersion string, network string) {
|
|||||||
"docker-version": dockerVersion,
|
"docker-version": dockerVersion,
|
||||||
"kernel-version": kernelVersion,
|
"kernel-version": kernelVersion,
|
||||||
}
|
}
|
||||||
if network != "" {
|
|
||||||
flags["network"] = network
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start background version checking
|
// Start background version checking
|
||||||
params := checkpoint.CheckParams{
|
params := checkpoint.CheckParams{
|
||||||
@@ -61,6 +59,21 @@ func checkForUpdates(dockerVersion string, network string) {
|
|||||||
Version: version,
|
Version: version,
|
||||||
SignatureFile: "",
|
SignatureFile: "",
|
||||||
Flags: flags,
|
Flags: flags,
|
||||||
|
ExtraFlags: func() []checkpoint.Flag { return checkpointFlags(router) },
|
||||||
}
|
}
|
||||||
checker = checkpoint.CheckInterval(¶ms, updateCheckPeriod, handleResponse)
|
checker = checkpoint.CheckInterval(¶ms, updateCheckPeriod, handleResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkpointFlags(router *weave.NetworkRouter) []checkpoint.Flag {
|
||||||
|
flags := []checkpoint.Flag{}
|
||||||
|
status := weave.NewNetworkRouterStatus(router)
|
||||||
|
for _, conn := range status.Connections {
|
||||||
|
if connectionName, ok := conn.Attrs["name"].(string); ok {
|
||||||
|
if _, encrypted := conn.Attrs["encrypted"]; encrypted {
|
||||||
|
connectionName = connectionName + " encrypted"
|
||||||
|
}
|
||||||
|
flags = append(flags, checkpoint.Flag{Key: "network", Value: connectionName})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flags
|
||||||
|
}
|
||||||
+11
-9
@@ -231,7 +231,8 @@ func main() {
|
|||||||
|
|
||||||
if bridge != nil {
|
if bridge != nil {
|
||||||
if err := weavenet.DetectHairpin("vethwe-bridge", Log); err != nil {
|
if err := weavenet.DetectHairpin("vethwe-bridge", Log); err != nil {
|
||||||
Log.Errorf("DetectHairpin failed: %s", err)
|
Log.Errorf("Setting may cause connectivity issues : %s", err)
|
||||||
|
Log.Infof("Hairpin mode may have been enabled by other software on this machine")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +255,8 @@ func main() {
|
|||||||
checkFatal(err)
|
checkFatal(err)
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
router := weave.NewNetworkRouter(config, networkConfig, name, nickName, overlay, db)
|
router, err := weave.NewNetworkRouter(config, networkConfig, name, nickName, overlay, db)
|
||||||
|
checkFatal(err)
|
||||||
Log.Println("Our name is", router.Ourself)
|
Log.Println("Our name is", router.Ourself)
|
||||||
|
|
||||||
if peers, err = router.InitialPeers(resume, peers); err != nil {
|
if peers, err = router.InitialPeers(resume, peers); err != nil {
|
||||||
@@ -274,11 +276,7 @@ func main() {
|
|||||||
dockerVersion = dockerCli.DockerVersion()
|
dockerVersion = dockerCli.DockerVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
network := ""
|
checkForUpdates(dockerVersion, router)
|
||||||
if isAWSVPC {
|
|
||||||
network = "awsvpc"
|
|
||||||
}
|
|
||||||
checkForUpdates(dockerVersion, network)
|
|
||||||
|
|
||||||
observeContainers := func(o docker.ContainerObserver) {
|
observeContainers := func(o docker.ContainerObserver) {
|
||||||
if dockerCli != nil {
|
if dockerCli != nil {
|
||||||
@@ -476,7 +474,9 @@ func createAllocator(router *weave.NetworkRouter, config ipamConfig, preClaims [
|
|||||||
|
|
||||||
allocator := ipam.NewAllocator(c)
|
allocator := ipam.NewAllocator(c)
|
||||||
|
|
||||||
allocator.SetInterfaces(router.NewGossip("IPallocation", allocator))
|
gossip, err := router.NewGossip("IPallocation", allocator)
|
||||||
|
checkFatal(err)
|
||||||
|
allocator.SetInterfaces(gossip)
|
||||||
allocator.Start()
|
allocator.Start()
|
||||||
router.Peers.OnGC(func(peer *mesh.Peer) { allocator.PeerGone(peer.Name) })
|
router.Peers.OnGC(func(peer *mesh.Peer) { allocator.PeerGone(peer.Name) })
|
||||||
|
|
||||||
@@ -486,7 +486,9 @@ func createAllocator(router *weave.NetworkRouter, config ipamConfig, preClaims [
|
|||||||
func createDNSServer(config dnsConfig, router *mesh.Router, isKnownPeer func(mesh.PeerName) bool) (*nameserver.Nameserver, *nameserver.DNSServer) {
|
func createDNSServer(config dnsConfig, router *mesh.Router, isKnownPeer func(mesh.PeerName) bool) (*nameserver.Nameserver, *nameserver.DNSServer) {
|
||||||
ns := nameserver.New(router.Ourself.Peer.Name, config.Domain, isKnownPeer)
|
ns := nameserver.New(router.Ourself.Peer.Name, config.Domain, isKnownPeer)
|
||||||
router.Peers.OnGC(func(peer *mesh.Peer) { ns.PeerGone(peer.Name) })
|
router.Peers.OnGC(func(peer *mesh.Peer) { ns.PeerGone(peer.Name) })
|
||||||
ns.SetGossip(router.NewGossip("nameserver", ns))
|
gossip, err := router.NewGossip("nameserver", ns)
|
||||||
|
checkFatal(err)
|
||||||
|
ns.SetGossip(gossip)
|
||||||
upstream := nameserver.NewUpstream(config.ResolvConf, config.EffectiveListenAddress)
|
upstream := nameserver.NewUpstream(config.ResolvConf, config.EffectiveListenAddress)
|
||||||
dnsserver, err := nameserver.NewDNSServer(ns, config.Domain, config.ListenAddress,
|
dnsserver, err := nameserver.NewDNSServer(ns, config.Domain, config.ListenAddress,
|
||||||
upstream, uint32(config.TTL), config.ClientTimeout)
|
upstream, uint32(config.TTL), config.ClientTimeout)
|
||||||
|
|||||||
@@ -14,11 +14,12 @@ import (
|
|||||||
|
|
||||||
func attach(args []string) error {
|
func attach(args []string) error {
|
||||||
if len(args) < 4 {
|
if len(args) < 4 {
|
||||||
cmdUsage("attach-container", "[--no-multicast-route] [--keep-tx-on] <container-id> <bridge-name> <mtu> <cidr>...")
|
cmdUsage("attach-container", "[--no-multicast-route] [--keep-tx-on] [--hairpin-mode=true|false] <container-id> <bridge-name> <mtu> <cidr>...")
|
||||||
}
|
}
|
||||||
|
|
||||||
keepTXOn := false
|
keepTXOn := false
|
||||||
withMulticastRoute := true
|
withMulticastRoute := true
|
||||||
|
hairpinMode := true
|
||||||
for i := 0; i < len(args); {
|
for i := 0; i < len(args); {
|
||||||
switch args[i] {
|
switch args[i] {
|
||||||
case "--no-multicast-route":
|
case "--no-multicast-route":
|
||||||
@@ -27,6 +28,9 @@ func attach(args []string) error {
|
|||||||
case "--keep-tx-on":
|
case "--keep-tx-on":
|
||||||
keepTXOn = true
|
keepTXOn = true
|
||||||
args = append(args[:i], args[i+1:]...)
|
args = append(args[:i], args[i+1:]...)
|
||||||
|
case "--hairpin-mode=false":
|
||||||
|
hairpinMode = false
|
||||||
|
args = append(args[:i], args[i+1:]...)
|
||||||
default:
|
default:
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
@@ -55,7 +59,7 @@ func attach(args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = weavenet.AttachContainer(weavenet.NSPathByPid(pid), fmt.Sprint(pid), weavenet.VethName, args[1], mtu, withMulticastRoute, cidrs, keepTXOn)
|
err = weavenet.AttachContainer(weavenet.NSPathByPid(pid), fmt.Sprint(pid), weavenet.VethName, args[1], mtu, withMulticastRoute, cidrs, keepTXOn, hairpinMode)
|
||||||
// If we detected an error but the container has died, tell the user that instead.
|
// If we detected an error but the container has died, tell the user that instead.
|
||||||
if err != nil && !processExists(pid) {
|
if err != nil && !processExists(pid) {
|
||||||
err = fmt.Errorf("Container %s died", args[0])
|
err = fmt.Errorf("Container %s died", args[0])
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
cni "github.com/appc/cni/pkg/skel"
|
cni "github.com/containernetworking/cni/pkg/skel"
|
||||||
|
"github.com/containernetworking/cni/pkg/version"
|
||||||
|
|
||||||
weaveapi "github.com/weaveworks/weave/api"
|
weaveapi "github.com/weaveworks/weave/api"
|
||||||
"github.com/weaveworks/weave/common"
|
"github.com/weaveworks/weave/common"
|
||||||
@@ -14,13 +15,13 @@ import (
|
|||||||
func cniNet(args []string) error {
|
func cniNet(args []string) error {
|
||||||
weave := weaveapi.NewClient(os.Getenv("WEAVE_HTTP_ADDR"), common.Log)
|
weave := weaveapi.NewClient(os.Getenv("WEAVE_HTTP_ADDR"), common.Log)
|
||||||
n := netplugin.NewCNIPlugin(weave)
|
n := netplugin.NewCNIPlugin(weave)
|
||||||
cni.PluginMain(n.CmdAdd, n.CmdDel)
|
cni.PluginMain(n.CmdAdd, n.CmdDel, version.PluginSupports("0.1.0", "0.2.0", "0.3.0"))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func cniIPAM(args []string) error {
|
func cniIPAM(args []string) error {
|
||||||
weave := weaveapi.NewClient(os.Getenv("WEAVE_HTTP_ADDR"), common.Log)
|
weave := weaveapi.NewClient(os.Getenv("WEAVE_HTTP_ADDR"), common.Log)
|
||||||
i := ipamplugin.NewIpam(weave)
|
i := ipamplugin.NewIpam(weave)
|
||||||
cni.PluginMain(i.CmdAdd, i.CmdDel)
|
cni.PluginMain(i.CmdAdd, i.CmdDel, version.PluginSupports("0.1.0", "0.2.0", "0.3.0"))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,6 @@ func dockerTLSArgs(args []string) error {
|
|||||||
switch {
|
switch {
|
||||||
case arg == "-d" || arg == "daemon":
|
case arg == "-d" || arg == "daemon":
|
||||||
isDaemon = true
|
isDaemon = true
|
||||||
break
|
|
||||||
case arg == "--tls", arg == "--tlsverify":
|
case arg == "--tls", arg == "--tlsverify":
|
||||||
tlsArgs = append(tlsArgs, arg)
|
tlsArgs = append(tlsArgs, arg)
|
||||||
case strings.HasPrefix(arg, "--tls"):
|
case strings.HasPrefix(arg, "--tls"):
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ func uniqueID(args []string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf(uid)
|
fmt.Print(uid)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
+6
-4
@@ -577,8 +577,8 @@ type fastDatapathForwarder struct {
|
|||||||
confirmed bool
|
confirmed bool
|
||||||
remoteAddr *net.UDPAddr
|
remoteAddr *net.UDPAddr
|
||||||
heartbeatInterval time.Duration
|
heartbeatInterval time.Duration
|
||||||
heartbeatTimer *time.Timer
|
heartbeatTimer *time.Timer // for sending
|
||||||
heartbeatTimeout *time.Timer
|
heartbeatTimeout *time.Timer // for receiving
|
||||||
ackedHeartbeat bool
|
ackedHeartbeat bool
|
||||||
stopChan chan struct{}
|
stopChan chan struct{}
|
||||||
stopped bool
|
stopped bool
|
||||||
@@ -856,7 +856,9 @@ func (fwd *fastDatapathForwarder) handleCryptoInitSARemote(msg []byte) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !fwd.isOutboundIPSecEstablished {
|
// FastDatapathCryptoInitSARemote can be received before Confirm'ing
|
||||||
|
// connection, thus before InitSALocal.
|
||||||
|
if fwd.confirmed && !fwd.isOutboundIPSecEstablished {
|
||||||
fwd.isOutboundIPSecEstablished = true
|
fwd.isOutboundIPSecEstablished = true
|
||||||
fwd.heartbeatTimer.Reset(0)
|
fwd.heartbeatTimer.Reset(0)
|
||||||
}
|
}
|
||||||
@@ -1222,7 +1224,7 @@ func (fastdp *FastDatapath) send(fops FlowOp, frame []byte, lock *fastDatapathLo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if fastdp.isHairpinFlow(&flow) {
|
if fastdp.isHairpinFlow(&flow) {
|
||||||
log.Error("Vetoed installation of hairpin flow ", flow)
|
log.Warning("Vetoed installation of hairpin flow ", flow)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ type NetworkRouter struct {
|
|||||||
db db.DB
|
db db.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNetworkRouter(config mesh.Config, networkConfig NetworkConfig, name mesh.PeerName, nickName string, overlay NetworkOverlay, db db.DB) *NetworkRouter {
|
func NewNetworkRouter(config mesh.Config, networkConfig NetworkConfig, name mesh.PeerName, nickName string, overlay NetworkOverlay, db db.DB) (*NetworkRouter, error) {
|
||||||
if overlay == nil {
|
if overlay == nil {
|
||||||
overlay = NullNetworkOverlay{}
|
overlay = NullNetworkOverlay{}
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,11 @@ func NewNetworkRouter(config mesh.Config, networkConfig NetworkConfig, name mesh
|
|||||||
networkConfig.Bridge = NullBridge{}
|
networkConfig.Bridge = NullBridge{}
|
||||||
}
|
}
|
||||||
|
|
||||||
router := &NetworkRouter{Router: mesh.NewRouter(config, name, nickName, overlay, common.LogLogger()), NetworkConfig: networkConfig, db: db}
|
meshRouter, err := mesh.NewRouter(config, name, nickName, overlay, common.LogLogger())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
router := &NetworkRouter{Router: meshRouter, NetworkConfig: networkConfig, db: db}
|
||||||
router.Peers.OnInvalidateShortIDs(overlay.InvalidateShortIDs)
|
router.Peers.OnInvalidateShortIDs(overlay.InvalidateShortIDs)
|
||||||
router.Routes.OnChange(overlay.InvalidateRoutes)
|
router.Routes.OnChange(overlay.InvalidateRoutes)
|
||||||
router.Macs = NewMacCache(macMaxAge,
|
router.Macs = NewMacCache(macMaxAge,
|
||||||
@@ -67,7 +71,7 @@ func NewNetworkRouter(config mesh.Config, networkConfig NetworkConfig, name mesh
|
|||||||
log.Println("Expired MAC", mac, "at", peer)
|
log.Println("Expired MAC", mac, "at", peer)
|
||||||
})
|
})
|
||||||
router.Peers.OnGC(func(peer *mesh.Peer) { router.Macs.Delete(peer) })
|
router.Peers.OnGC(func(peer *mesh.Peer) { router.Macs.Delete(peer) })
|
||||||
return router
|
return router, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start listening for TCP connections, locally captured packets, and
|
// Start listening for TCP connections, locally captured packets, and
|
||||||
|
|||||||
+5
-3
@@ -6,7 +6,6 @@
|
|||||||
package router
|
package router
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@@ -1039,6 +1038,9 @@ func (sender *udpSenderDF) dial() error {
|
|||||||
laddr := &net.IPAddr{IP: sender.localIP}
|
laddr := &net.IPAddr{IP: sender.localIP}
|
||||||
raddr := &net.IPAddr{IP: sender.remoteIP}
|
raddr := &net.IPAddr{IP: sender.remoteIP}
|
||||||
s, err := net.DialIP("ip4:UDP", laddr, raddr)
|
s, err := net.DialIP("ip4:UDP", laddr, raddr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
f, err := s.File()
|
f, err := s.File()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1059,7 +1061,7 @@ func (sender *udpSenderDF) dial() error {
|
|||||||
|
|
||||||
func (sender *udpSenderDF) send(msg []byte, raddr *net.UDPAddr) error {
|
func (sender *udpSenderDF) send(msg []byte, raddr *net.UDPAddr) error {
|
||||||
// Ensure we have a socket sending to the right IP address
|
// Ensure we have a socket sending to the right IP address
|
||||||
if sender.socket == nil || !bytes.Equal(sender.remoteIP, raddr.IP) {
|
if sender.socket == nil || !sender.remoteIP.Equal(raddr.IP) {
|
||||||
sender.remoteIP = raddr.IP
|
sender.remoteIP = raddr.IP
|
||||||
if err := sender.dial(); err != nil {
|
if err := sender.dial(); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1111,7 +1113,7 @@ func (sender *udpSenderDF) close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func udpAddrsEqual(a *net.UDPAddr, b *net.UDPAddr) bool {
|
func udpAddrsEqual(a *net.UDPAddr, b *net.UDPAddr) bool {
|
||||||
return bytes.Equal(a.IP, b.IP) && a.Port == b.Port && a.Zone == b.Zone
|
return a.IP.Equal(b.IP) && a.Port == b.Port && a.Zone == b.Zone
|
||||||
}
|
}
|
||||||
|
|
||||||
func allZeros(s []byte) bool {
|
func allZeros(s []byte) bool {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Building Weave Net
|
title: Building Weave Net
|
||||||
menu_order: 120
|
menu_order: 120
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
You only need to build Weave Net if you want to work on the Weave Net codebase
|
You only need to build Weave Net if you want to work on the Weave Net codebase
|
||||||
(or you just enjoy building software).
|
(or you just enjoy building software).
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Integrating Kubernetes and Mesos via the CNI Plugin
|
title: Integrating Kubernetes and Mesos via the CNI Plugin
|
||||||
menu_order: 65
|
menu_order: 65
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
> The recommended way of using Weave with Kubernetes is via the new
|
> The recommended way of using Weave with Kubernetes is via the new
|
||||||
@@ -11,7 +12,7 @@ menu_order: 65
|
|||||||
CNI, the [_Container Network Interface_](https://github.com/containernetworking/cni),
|
CNI, the [_Container Network Interface_](https://github.com/containernetworking/cni),
|
||||||
is a proposed standard for configuring network interfaces for Linux
|
is a proposed standard for configuring network interfaces for Linux
|
||||||
application containers. CNI is supported by
|
application containers. CNI is supported by
|
||||||
[Kubernetes](http://kubernetes.io/), [Apache Mesos](mesos.apache.org)
|
[Kubernetes](http://kubernetes.io/), [Apache Mesos](http://mesos.apache.org)
|
||||||
and
|
and
|
||||||
[others](https://github.com/containernetworking/cni#who-is-using-cni).
|
[others](https://github.com/containernetworking/cni#who-is-using-cni).
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: FAQ
|
title: FAQ
|
||||||
menu_order: 200
|
menu_order: 200
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Feature Overview
|
title: Feature Overview
|
||||||
menu_order: 20
|
menu_order: 20
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
* [Virtual Ethernet Switch](#virtual-ethernet-switch)
|
* [Virtual Ethernet Switch](#virtual-ethernet-switch)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Understanding how Weave Net Works
|
title: Understanding how Weave Net Works
|
||||||
menu_order: 90
|
menu_order: 90
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: How Weave Net Implements Encryption
|
title: How Weave Net Implements Encryption
|
||||||
menu_order: 70
|
menu_order: 70
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
This section describes some details of Weave Net's built-in
|
This section describes some details of Weave Net's built-in
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Encryption and Weave Net
|
title: Encryption and Weave Net
|
||||||
menu_order: 60
|
menu_order: 60
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: How Fast Datapath Works
|
title: How Fast Datapath Works
|
||||||
menu_order: 30
|
menu_order: 30
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: IP Addresses, Routes and Networks
|
title: IP Addresses, Routes and Networks
|
||||||
menu_order: 50
|
menu_order: 50
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: How Weave Net Interprets Network Topology
|
title: How Weave Net Interprets Network Topology
|
||||||
menu_order: 20
|
menu_order: 20
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
This section contains the following topics:
|
This section contains the following topics:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Weave Net Router Sleeve Encapsulation
|
title: Weave Net Router Sleeve Encapsulation
|
||||||
menu_order: 10
|
menu_order: 10
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
When the Weave Net router forwards packets to peers in `sleeve` mode
|
When the Weave Net router forwards packets to peers in `sleeve` mode
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
---
|
---
|
||||||
title: Installing Weave Net
|
title: Installing Weave Net
|
||||||
menu_order: 30
|
menu_order: 30
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
Ensure you are running Linux (kernel 3.8 or later) and have Docker
|
Ensure you are running Linux (kernel 3.8 or later) and have Docker
|
||||||
(version 1.6.0 or later) installed.
|
(version 1.10.0 or later) installed.
|
||||||
|
|
||||||
Install Weave Net by running the following:
|
Install Weave Net by running the following:
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ To disable this check, run the following before launching Weave Net:
|
|||||||
CoreOS users see [here](/guides/networking-docker-containers-with-weave-on-coreos/) for an example of installing Weave using cloud-config.
|
CoreOS users see [here](/guides/networking-docker-containers-with-weave-on-coreos/) for an example of installing Weave using cloud-config.
|
||||||
|
|
||||||
Amazon ECS users see [here](https://github.com/weaveworks/integrations/blob/master/aws/ecs/README.md)
|
Amazon ECS users see [here](https://github.com/weaveworks/integrations/blob/master/aws/ecs/README.md)
|
||||||
for the latest Weave AMIs and [here](http://weave.works/guides/service-discovery-with-weave-aws-ecs.html) to get started with Weave Net on ECS.
|
for the latest Weave AMIs and [here](https://www.weave.works/docs/tutorials/old-guides/ecs/) to get started with Weave Net on ECS.
|
||||||
|
|
||||||
If you're on Amazon EC2, the standard installation instructions at the
|
If you're on Amazon EC2, the standard installation instructions at the
|
||||||
top of this page, provide the simplest setup and the most flexibility.
|
top of this page, provide the simplest setup and the most flexibility.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Using Weave with Systemd
|
title: Using Weave with Systemd
|
||||||
menu_order: 130
|
menu_order: 130
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Introducing Weave Net
|
title: Introducing Weave Net
|
||||||
menu_order: 10
|
menu_order: 10
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Allocating IP Addresses
|
title: Allocating IP Addresses
|
||||||
menu_order: 70
|
menu_order: 70
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Automatic Allocation Across Multiple Subnets
|
title: Automatic Allocation Across Multiple Subnets
|
||||||
menu_order: 10
|
menu_order: 10
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Starting, Stopping and Removing Peers
|
title: Starting, Stopping and Removing Peers
|
||||||
menu_order: 20
|
menu_order: 20
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Troubleshooting the IP Allocator
|
title: Troubleshooting the IP Allocator
|
||||||
menu_order: 30
|
menu_order: 30
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+103
-14
@@ -1,13 +1,16 @@
|
|||||||
---
|
---
|
||||||
title: Integrating Kubernetes via the Addon
|
title: Integrating Kubernetes via the Addon
|
||||||
menu_order: 63
|
menu_order: 63
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
The following topics are discussed:
|
The following topics are discussed:
|
||||||
|
|
||||||
* [Installation](#install)
|
* [Installation](#install)
|
||||||
* [Network Policy Controller](#npc)
|
* [Upgrading Kubernetes to version 1.6](#kube-1.6-upgrade)
|
||||||
* [Upgrading the Daemon Sets](#daemon-sets)
|
* [Upgrading the Daemon Sets](#daemon-sets)
|
||||||
|
* [CPU and Memory Requirements](#resources)
|
||||||
|
* [Pod Eviction](#eviction)
|
||||||
* [Network Policy Controller](#npc)
|
* [Network Policy Controller](#npc)
|
||||||
* [Troubleshooting Blocked Connections](#blocked-connections)
|
* [Troubleshooting Blocked Connections](#blocked-connections)
|
||||||
* [Changing Configuration Options](#configuration-options)
|
* [Changing Configuration Options](#configuration-options)
|
||||||
@@ -18,15 +21,24 @@ The following topics are discussed:
|
|||||||
Weave Net can be installed onto your CNI-enabled Kubernetes cluster
|
Weave Net can be installed onto your CNI-enabled Kubernetes cluster
|
||||||
with a single command:
|
with a single command:
|
||||||
|
|
||||||
|
* Kubernetes versions `1.6` and above:
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl apply -f https://git.io/weave-kube
|
$ kubectl apply -f https://git.io/weave-kube-1.6
|
||||||
|
```
|
||||||
|
|
||||||
|
* Kubernetes versions up to `1.5`:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ kubectl apply -f https://git.io/weave-kube
|
||||||
```
|
```
|
||||||
|
|
||||||
After a few seconds, a Weave Net pod should be running on each
|
After a few seconds, a Weave Net pod should be running on each
|
||||||
Node and any further pods you create will be automatically attached to the Weave
|
Node and any further pods you create will be automatically attached to the Weave
|
||||||
network.
|
network.
|
||||||
|
|
||||||
**Note:** This command requires Kubernetes 1.4 or later.
|
**Note:** This command requires Kubernetes 1.4 or later, and we
|
||||||
|
recommend your master node has at least two CPU cores.
|
||||||
|
|
||||||
> CNI, the [_Container Network Interface_](https://github.com/containernetworking/cni),
|
> CNI, the [_Container Network Interface_](https://github.com/containernetworking/cni),
|
||||||
> is a proposed standard for configuring network interfaces for Linux
|
> is a proposed standard for configuring network interfaces for Linux
|
||||||
@@ -51,11 +63,26 @@ Shut down Kubernetes, and _on all nodes_ perform the following:
|
|||||||
Then relaunch Kubernetes and install the addon as described
|
Then relaunch Kubernetes and install the addon as described
|
||||||
above.
|
above.
|
||||||
|
|
||||||
The URL [https://git.io/weave-kube](https://git.io/weave-kube) points
|
The URLs [https://git.io/weave-kube](https://git.io/weave-kube) and [https://git.io/weave-kube-1.6](https://git.io/weave-kube-1.6) point
|
||||||
to the YAML file for the latest release of the Weave Net addon.
|
to the YAML file for the [latest release](https://github.com/weaveworks/weave/releases/tag/latest_release) of the Weave Net addon.
|
||||||
Historic versions are archived on our [GitHub release
|
Historic versions are archived on our [GitHub release
|
||||||
page](https://github.com/weaveworks/weave/releases).
|
page](https://github.com/weaveworks/weave/releases).
|
||||||
|
|
||||||
|
## <a name="kube-1.6-upgrade"></a> Upgrading Kubernetes to version 1.6
|
||||||
|
|
||||||
|
In version 1.6, Kubernetes has increased security, so we need to
|
||||||
|
create a special service account to run Weave Net. This is done in
|
||||||
|
the file `weave-daemonset-k8s-1.6.yaml` attached to the [Weave Net
|
||||||
|
release](https://github.com/weaveworks/weave/releases/latest).
|
||||||
|
|
||||||
|
Also, the
|
||||||
|
[toleration](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/taint-toleration-dedicated.md)
|
||||||
|
required to let Weave Net run on master nodes has moved from an
|
||||||
|
annotation to a field on the DaemonSet spec object.
|
||||||
|
|
||||||
|
If you have edited the Weave Net DaemonSet from a previous release,
|
||||||
|
you will need to re-make your changes against the new version.
|
||||||
|
|
||||||
### <a name="daemon-sets"></a> Upgrading the Daemon Sets
|
### <a name="daemon-sets"></a> Upgrading the Daemon Sets
|
||||||
|
|
||||||
Kubernetes does not currently support rolling upgrades of daemon sets,
|
Kubernetes does not currently support rolling upgrades of daemon sets,
|
||||||
@@ -68,6 +95,64 @@ and so you will need to perform the procedure manually:
|
|||||||
lose track of IP address range ownership, possibly leading to
|
lose track of IP address range ownership, possibly leading to
|
||||||
duplicate IP addresses if you then start a new copy of Weave Net.
|
duplicate IP addresses if you then start a new copy of Weave Net.
|
||||||
|
|
||||||
|
## <a name="resources"></a>CPU and Memory Requirements
|
||||||
|
|
||||||
|
Kubernetes manages
|
||||||
|
[resources](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/)
|
||||||
|
on each node, and only schedules pods to run on nodes that have enough
|
||||||
|
free resources.
|
||||||
|
|
||||||
|
The components of a typical Kubernetes installation (with the master
|
||||||
|
node running etcd, scheduler, api-server, etc.) take up about 95% of a
|
||||||
|
CPU, which leaves little room to run anything else. For all of Weave
|
||||||
|
Net's features to work, it must run on every node, including the
|
||||||
|
master.
|
||||||
|
|
||||||
|
The best way to resolve this issue is to use machines with at least
|
||||||
|
two CPU cores. However if you are installing Kubernetes and Weave Net
|
||||||
|
for the first time, you may not be aware of this requirement. For this
|
||||||
|
reason, Weave Net launches as a DaemonSet with a specification that
|
||||||
|
reserves at least 1% CPU for each container. This enables Weave Net to
|
||||||
|
start up seamlessly on a single-CPU node.
|
||||||
|
|
||||||
|
Depending on the workload, Weave Net may need more than 1% of the
|
||||||
|
CPU. The percentage set in the DaemonSet is the minimum and not a
|
||||||
|
limit. This minimum setting allows Weave Net to take advantage of
|
||||||
|
available CPU and "burst" above that limit if it needs to.
|
||||||
|
|
||||||
|
## <a name="eviction"></a>Pod Eviction
|
||||||
|
|
||||||
|
If a node runs out of CPU, memory or disk, Kubernetes may [decide to
|
||||||
|
evict](https://kubernetes.io/docs/concepts/cluster-administration/out-of-resource/)
|
||||||
|
one or more pods. It may choose to evict the Weave Net pod, which will
|
||||||
|
disrupt pod network operations.
|
||||||
|
|
||||||
|
You can reduce the chance of eviction by changing the DaemonSet to
|
||||||
|
have a much bigger request, and a limit of the same value.
|
||||||
|
|
||||||
|
This causes Kubernetes to apply a ["guaranteed" rather than a
|
||||||
|
"burstable" policy](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/resource-qos.md).
|
||||||
|
However a similar request for disk space can not
|
||||||
|
be made, and so please be aware of this issue and monitor your
|
||||||
|
resources to ensure that they stay below 100%.
|
||||||
|
|
||||||
|
You can see when pods have been evicted via the `kubectl get events` command
|
||||||
|
|
||||||
|
```
|
||||||
|
LASTSEEN COUNT NAME KIND TYPE REASON SOURCE MESSAGE
|
||||||
|
1m 1 mypod-09vkd Pod Warning Evicted kubelet, node-1 The node was low on resource: memory.
|
||||||
|
```
|
||||||
|
|
||||||
|
or `kubectl get pods`
|
||||||
|
|
||||||
|
```
|
||||||
|
NAME READY STATUS RESTARTS AGE IP NODE
|
||||||
|
mypod-09vkd 0/1 Evicted 0 1h <none> node-1
|
||||||
|
```
|
||||||
|
|
||||||
|
If you see this in your cluster, consider some of the above steps to
|
||||||
|
reduce disruption.
|
||||||
|
|
||||||
## <a name="npc"></a>Network Policy Controller
|
## <a name="npc"></a>Network Policy Controller
|
||||||
|
|
||||||
The addon also supports the [Kubernetes policy
|
The addon also supports the [Kubernetes policy
|
||||||
@@ -138,21 +223,25 @@ inserted into the YAML file like this:
|
|||||||
|
|
||||||
The list of variables you can set is:
|
The list of variables you can set is:
|
||||||
|
|
||||||
* CHECKPOINT\_DISABLE - if set to 1, disable checking for new Weave Net
|
* `CHECKPOINT_DISABLE` - if set to 1, disable checking for new Weave Net
|
||||||
versions (default is blank, i.e. check is enabled)
|
versions (default is blank, i.e. check is enabled)
|
||||||
* IPALLOC\_RANGE - the range of IP addresses used by Weave Net
|
* `IPALLOC_RANGE` - the range of IP addresses used by Weave Net
|
||||||
and the subnet they are placed in (CIDR format; default 10.32.0.0/12)
|
and the subnet they are placed in (CIDR format; default `10.32.0.0/12`)
|
||||||
* EXPECT\_NPC - set to 0 to disable Network Policy Controller (default is on)
|
* `EXPECT_NPC` - set to 0 to disable Network Policy Controller (default is on)
|
||||||
* KUBE\_PEERS - list of addresses of peers in the Kubernetes cluster
|
* `KUBE_PEERS` - list of addresses of peers in the Kubernetes cluster
|
||||||
(default is to fetch the list from the api-server)
|
(default is to fetch the list from the api-server)
|
||||||
* IPALLOC\_INIT - set the initialization mode of the [IP Address
|
* `IPALLOC_INIT` - set the initialization mode of the [IP Address
|
||||||
Manager](/site/operational-guide/concepts.md#ip-address-manager)
|
Manager](/site/operational-guide/concepts.md#ip-address-manager)
|
||||||
(defaults to consensus amongst the KUBE\_PEERS)
|
(defaults to consensus amongst the `KUBE_PEERS`)
|
||||||
* WEAVE\_EXPOSE\_IP - set the IP address used as a gateway from the
|
* `WEAVE_EXPOSE_IP` - set the IP address used as a gateway from the
|
||||||
Weave network to the host network - this is useful if you are
|
Weave network to the host network - this is useful if you are
|
||||||
configuring the addon as a static pod.
|
configuring the addon as a static pod.
|
||||||
* WEAVE\_MTU - Weave Net defaults to 1376 bytes, but you can set a
|
* `WEAVE_MTU` - Weave Net defaults to 1376 bytes, but you can set a
|
||||||
smaller size if your underlying network has a tighter limit, or set
|
smaller size if your underlying network has a tighter limit, or set
|
||||||
a larger size for better performance if your network supports jumbo
|
a larger size for better performance if your network supports jumbo
|
||||||
frames - see [here](/site/using-weave/fastdp.md#mtu) for more
|
frames - see [here](/site/using-weave/fastdp.md#mtu) for more
|
||||||
details.
|
details.
|
||||||
|
* `HAIRPIN_MODE` - Weave Net defaults to enabling hairpin on the bridge side of
|
||||||
|
the `veth` pair for containers attached. If you need to disable hairpin, e.g. your
|
||||||
|
kernel is one of those that can panic if hairpin is enabled, then you can disable it
|
||||||
|
by setting `HAIRPIN_MODE=false`.
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Monitoring with Prometheus
|
title: Monitoring with Prometheus
|
||||||
menu_order: 105
|
menu_order: 105
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
Two endpoints are exposed: one for the Weave Net router, and, when deployed as
|
Two endpoints are exposed: one for the Weave Net router, and, when deployed as
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Operational Guide
|
title: Operational Guide
|
||||||
menu_order: 45
|
menu_order: 45
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
This operational guide is intended to give you an overview of how to
|
This operational guide is intended to give you an overview of how to
|
||||||
operate and manage a Weave Network in production. It consists of three
|
operate and manage a Weave Network in production. It consists of three
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Autoscaling
|
title: Autoscaling
|
||||||
menu_order: 40
|
menu_order: 40
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
### Bootstrapping
|
### Bootstrapping
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Concepts
|
title: Concepts
|
||||||
menu_order: 10
|
menu_order: 10
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
This section describes some of the essential concepts with which you will
|
This section describes some of the essential concepts with which you will
|
||||||
need to be familiar before continuing to the example deployment
|
need to be familiar before continuing to the example deployment
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Interactive Deployment
|
title: Interactive Deployment
|
||||||
menu_order: 20
|
menu_order: 20
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
Weave Net can be launched interactively on the command line, and as
|
Weave Net can be launched interactively on the command line, and as
|
||||||
long as Docker is configured to start on boot, the network will survive
|
long as Docker is configured to start on boot, the network will survive
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Administrative Tasks
|
title: Administrative Tasks
|
||||||
menu_order: 60
|
menu_order: 60
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
The following administrative tasks are discussed:
|
The following administrative tasks are discussed:
|
||||||
@@ -43,7 +44,7 @@ or possible:
|
|||||||
In some cases you may already be aware of the problem, as you were
|
In some cases you may already be aware of the problem, as you were
|
||||||
unable to execute `weave reset` successfully or because you know
|
unable to execute `weave reset` successfully or because you know
|
||||||
through other channels that the host has died. In these cases you can
|
through other channels that the host has died. In these cases you can
|
||||||
proceed straight to [Manually Reclaiming Lost Address Space](#reclaim-address-space).
|
proceed straight to [Manually Reclaiming Lost Address Space](#manually-reclaim-address-space).
|
||||||
|
|
||||||
However in some scenarios it may not be obvious that space has been
|
However in some scenarios it may not be obvious that space has been
|
||||||
lost, in which case you can check for it periodically with the
|
lost, in which case you can check for it periodically with the
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Uniform Dynamic Clusters
|
title: Uniform Dynamic Clusters
|
||||||
menu_order: 50
|
menu_order: 50
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
A uniform dynamic cluster has the following characteristics:
|
A uniform dynamic cluster has the following characteristics:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Uniform Fixed Clusters
|
title: Uniform Fixed Clusters
|
||||||
menu_order: 30
|
menu_order: 30
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
This scenario describes a production deployment of a fixed number of N
|
This scenario describes a production deployment of a fixed number of N
|
||||||
|
|||||||
+1
-1
@@ -1,11 +1,11 @@
|
|||||||
---
|
---
|
||||||
title: Integrating Docker via the Network Plugin
|
title: Integrating Docker via the Network Plugin
|
||||||
menu_order: 60
|
menu_order: 60
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
* [Launching Weave Net and Running Containers Using the Plugin](#launching)
|
* [Launching Weave Net and Running Containers Using the Plugin](#launching)
|
||||||
* [Restarting the Plugin](#restarting)
|
* [Restarting the Plugin](#restarting)
|
||||||
* [Configuring the Plugin](#configuring)
|
|
||||||
|
|
||||||
Docker versions 1.9 and later have a plugin mechanism for adding
|
Docker versions 1.9 and later have a plugin mechanism for adding
|
||||||
different network providers. Weave Net installs itself as a network
|
different network providers. Weave Net installs itself as a network
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: How the Weave Net Docker Network Plugin Works
|
title: How the Weave Net Docker Network Plugin Works
|
||||||
menu_order: 20
|
menu_order: 20
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Troubleshooting Weave Net
|
title: Troubleshooting Weave Net
|
||||||
menu_order: 110
|
menu_order: 110
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1,9 +1,10 @@
|
|||||||
---
|
---
|
||||||
title: Using Weave Net
|
title: Using Weave Net
|
||||||
menu_order: 40
|
menu_order: 40
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
Weave Net provides a simple to deploy networking solution for containerized apps. Here, we describe how to manage a Weave container network using a sample application which consists of two simple `netcat` services deployed to containers on two separate hosts, and sometimes extended across three hosts.
|
Weave Net provides a simple to deploy networking solution for containerized apps. Here, we describe how to manage a Weave container network using a sample application which consists of two simple `netcat` services deployed to containers on two separate hosts.
|
||||||
|
|
||||||
This section contains the following topics:
|
This section contains the following topics:
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Isolating Applications on a Weave Network
|
title: Isolating Applications on a Weave Network
|
||||||
menu_order: 30
|
menu_order: 30
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
A single Weave network can host multiple, isolated applications where each application's containers are able
|
A single Weave network can host multiple, isolated applications where each application's containers are able
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Using IP Routing on an Amazon Web Services Virtual Private Cloud
|
title: Using IP Routing on an Amazon Web Services Virtual Private Cloud
|
||||||
menu_order: 110
|
menu_order: 110
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
If your container infrastructure is running entirely within Amazon Web Services (AWS)
|
If your container infrastructure is running entirely within Amazon Web Services (AWS)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Allocating IPs in a Specific Range
|
title: Allocating IPs in a Specific Range
|
||||||
menu_order: 15
|
menu_order: 15
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
The default configurations for both Weave Net and Docker use [Private
|
The default configurations for both Weave Net and Docker use [Private
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Dynamically Attaching and Detaching Applications
|
title: Dynamically Attaching and Detaching Applications
|
||||||
menu_order: 40
|
menu_order: 40
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Using Fast Datapath
|
title: Using Fast Datapath
|
||||||
menu_order: 96
|
menu_order: 96
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Adding and Removing Hosts Dynamically
|
title: Adding and Removing Hosts Dynamically
|
||||||
menu_order: 90
|
menu_order: 90
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
To add a host to an existing Weave network, launch Weave Net on the
|
To add a host to an existing Weave network, launch Weave Net on the
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Integrating with the Host Network
|
title: Integrating with the Host Network
|
||||||
menu_order: 60
|
menu_order: 60
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
Weave application networks can be integrated with an external host network, establishing connectivity between the host and with application containers running anywhere.
|
Weave application networks can be integrated with an external host network, establishing connectivity between the host and with application containers running anywhere.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Manually Specifying the IP Address of a Container
|
title: Manually Specifying the IP Address of a Container
|
||||||
menu_order: 20
|
menu_order: 20
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
Containers are automatically allocated an IP address that is unique across the Weave network. You can see which address was allocated by running, [`weave ps`](/site/troubleshooting.md#weave-status):
|
Containers are automatically allocated an IP address that is unique across the Weave network. You can see which address was allocated by running, [`weave ps`](/site/troubleshooting.md#weave-status):
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Enabling Multi-Cloud, Multi-Hop Networking and Routing
|
title: Enabling Multi-Cloud, Multi-Hop Networking and Routing
|
||||||
menu_order: 100
|
menu_order: 100
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Securing Connections Across Untrusted Networks
|
title: Securing Connections Across Untrusted Networks
|
||||||
menu_order: 80
|
menu_order: 80
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
@@ -15,23 +16,21 @@ or
|
|||||||
host1$ export WEAVE_PASSWORD=wfvAwt7sj
|
host1$ export WEAVE_PASSWORD=wfvAwt7sj
|
||||||
host1$ weave launch
|
host1$ weave launch
|
||||||
|
|
||||||
>**NOTE**: The command line option takes precedence over the environment variable._
|
>**NOTE**: The command line option takes precedence over the environment variable.
|
||||||
|
|
||||||
> To avoid leaking your password via the kernel process table or your
|
> To avoid leaking your password via the kernel process table or your
|
||||||
> shell history, we recommend you store it in a file and capture it
|
> shell history, we recommend you store it in a file and capture it
|
||||||
> in a shell variable prior to launching weave: `export
|
> in a shell variable prior to launching weave: `export
|
||||||
> WEAVE_PASSWORD=$(cat /path/to/password-file)`
|
> WEAVE_PASSWORD=$(cat /path/to/password-file)`
|
||||||
|
|
||||||
To guard against dictionary attacks, the password needs to be reasonably strong with at least 50 bits of entropy is recommended. An easy way to generate a random password that satisfies this requirement is:
|
To guard against dictionary attacks, the password needs to be reasonably strong,
|
||||||
|
with at least 50 bits of entropy. An easy way to generate a random password that
|
||||||
|
satisfies this requirement is:
|
||||||
|
|
||||||
< /dev/urandom tr -dc A-Za-z0-9 | head -c9 ; echo
|
< /dev/urandom tr -dc A-Za-z0-9 | head -c9 ; echo
|
||||||
|
|
||||||
The same password must be specified for all Weave Net peers, by default both control and data plane traffic will then use authenticated encryption.
|
The same password must be specified for all Weave Net peers, by default both control and data plane traffic will then use authenticated encryption.
|
||||||
|
|
||||||
[Fast datapath](/site/using-weave/fastdp.md) does not support
|
|
||||||
encryption. If you supply a password at `weave launch`, Weave Net
|
|
||||||
falls back to the slower `sleeve` mode for encrypted communication.
|
|
||||||
|
|
||||||
As an optimization, you can selectively disable data plane encryption
|
As an optimization, you can selectively disable data plane encryption
|
||||||
if some of your peers are co-located in a trusted network, for example
|
if some of your peers are co-located in a trusted network, for example
|
||||||
within the boundary of your own data center. List these networks using
|
within the boundary of your own data center. List these networks using
|
||||||
@@ -40,9 +39,8 @@ the `--trusted-subnets` argument with `weave launch`:
|
|||||||
weave launch --password wfvAwt7sj --trusted-subnets 10.0.2.0/24,192.168.48.0/24
|
weave launch --password wfvAwt7sj --trusted-subnets 10.0.2.0/24,192.168.48.0/24
|
||||||
|
|
||||||
If *both* peers at the end of a connection consider the other to be in
|
If *both* peers at the end of a connection consider the other to be in
|
||||||
a trusted subnet, Weave Net attempts to establish fast datapath
|
the same trusted subnet, Weave Net attempts to establish non-encrypted
|
||||||
connectivity, which is unencrypted. Otherwise communication is encrypted which
|
connectivity. Otherwise communication is encrypted which imposes overheads.
|
||||||
imposes overheads.
|
|
||||||
|
|
||||||
Configured trusted subnets are shown in [`weave status`](/site/troubleshooting.md#weave-status).
|
Configured trusted subnets are shown in [`weave status`](/site/troubleshooting.md#weave-status).
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Managing Services - Exporting, Importing, Binding and Routing
|
title: Managing Services - Exporting, Importing, Binding and Routing
|
||||||
menu_order: 70
|
menu_order: 70
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
This section contains the following topics:
|
This section contains the following topics:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Integrating Docker via the API Proxy
|
title: Integrating Docker via the API Proxy
|
||||||
menu_order: 50
|
menu_order: 50
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
The Docker API proxy automatically attaches containers to the Weave
|
The Docker API proxy automatically attaches containers to the Weave
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Using Automatic Discovery With the Weave Net Proxy
|
title: Using Automatic Discovery With the Weave Net Proxy
|
||||||
menu_order: 30
|
menu_order: 30
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
Containers launched via the proxy use [weaveDNS](/site/weavedns.md)
|
Containers launched via the proxy use [weaveDNS](/site/weavedns.md)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Automatic IP Allocation and the Weave Proxy
|
title: Automatic IP Allocation and the Weave Proxy
|
||||||
menu_order: 25
|
menu_order: 25
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Launching Containers With Weave Run (without the Proxy)
|
title: Launching Containers With Weave Run (without the Proxy)
|
||||||
menu_order: 50
|
menu_order: 50
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Name resolution via `/etc/hosts`
|
title: Name resolution via `/etc/hosts`
|
||||||
menu_order: 40
|
menu_order: 40
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Securing the Docker Communications With TLS
|
title: Securing the Docker Communications With TLS
|
||||||
menu_order: 20
|
menu_order: 20
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
If you are [connecting to the docker daemon with
|
If you are [connecting to the docker daemon with
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Troubleshooting
|
title: Troubleshooting
|
||||||
menu_order: 60
|
menu_order: 60
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
The command
|
The command
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Using The Weave Docker API Proxy
|
title: Using The Weave Docker API Proxy
|
||||||
menu_order: 10
|
menu_order: 10
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Discovering Containers with WeaveDNS
|
title: Discovering Containers with WeaveDNS
|
||||||
menu_order: 80
|
menu_order: 80
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: How Weave Finds Containers
|
title: How Weave Finds Containers
|
||||||
menu_order: 10
|
menu_order: 10
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Load Balancing and Fault Resilience with weaveDNS
|
title: Load Balancing and Fault Resilience with weaveDNS
|
||||||
menu_order: 20
|
menu_order: 20
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ WeaveDNS removes the addresses of any container that dies. This offers
|
|||||||
a simple way to implement redundancy. E.g. if in our example we stop
|
a simple way to implement redundancy. E.g. if in our example we stop
|
||||||
one of the `pingme` containers and re-run the ping tests, eventually
|
one of the `pingme` containers and re-run the ping tests, eventually
|
||||||
(within ~30s at most, since that is the weaveDNS
|
(within ~30s at most, since that is the weaveDNS
|
||||||
[cache expiry time](#ttl)) we will only be hitting the address of the
|
[cache expiry time](/site/weavedns/managing-entries-weavedns.md#ttl)) we will only be hitting the address of the
|
||||||
container that is still alive.
|
container that is still alive.
|
||||||
|
|
||||||
**See Also**
|
**See Also**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Managing Domains
|
title: Managing Domains
|
||||||
menu_order: 30
|
menu_order: 30
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
The following topics are discussed:
|
The following topics are discussed:
|
||||||
@@ -44,6 +45,6 @@ link-local as per [RFC6762](https://tools.ietf.org/html/rfc6762),
|
|||||||
(though this is not strictly necessary).
|
(though this is not strictly necessary).
|
||||||
|
|
||||||
|
|
||||||
* [How Weave Finds Containers](/site/how-works-weavedns.md.md)
|
* [How Weave Finds Containers](/site/how-works-weavedns.md)
|
||||||
* [Load Balancing and Fault Resilience with WeaveDNS](/site/weavedns/load-balance-fault-weavedns.md)
|
* [Load Balancing and Fault Resilience with WeaveDNS](/site/weavedns/load-balance-fault-weavedns.md)
|
||||||
* [Managing Domain Entries](/site/weavedns/managing-entries-weavedns.md)
|
* [Managing Domain Entries](/site/weavedns/managing-entries-weavedns.md)
|
||||||
@@ -1,19 +1,16 @@
|
|||||||
---
|
---
|
||||||
title: Managing Domain Entries
|
title: Managing Domain Entries
|
||||||
menu_order: 40
|
menu_order: 40
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
The following topics are discussed:
|
The following topics are discussed:
|
||||||
|
|
||||||
* [Adding and removing extra DNS entries](#add-remove)
|
* [Adding and removing extra DNS entries](#add-remove)
|
||||||
* [Resolving WeaveDNS entries from the Host](#resolve-weavedns-entries-from-host)
|
* [Resolving WeaveDNS entries from the Host](#resolve-weavedns-entries-from-host)
|
||||||
* [Hot-swapping Service Containers](#hot-swapping)
|
* [Hot-swapping Service Containers](#hot-swapping)
|
||||||
* [Retaining DNS Entries When Containers Stop](#retain-stopped)
|
|
||||||
* [Configuring a Custom TTL](#ttl)
|
* [Configuring a Custom TTL](#ttl)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### <a name="add-remove"></a>Adding and Removing Extra DNS Entries
|
### <a name="add-remove"></a>Adding and Removing Extra DNS Entries
|
||||||
|
|
||||||
If you want to give the container a name in DNS *other* than its
|
If you want to give the container a name in DNS *other* than its
|
||||||
@@ -81,6 +78,6 @@ weaveDNS instance will receive.
|
|||||||
|
|
||||||
**See Also**
|
**See Also**
|
||||||
|
|
||||||
* [How Weave Finds Containers](/site/how-works-weavedns.md)
|
* [How Weave Finds Containers](/site/weavedns/how-works-weavedns.md)
|
||||||
* [Load Balancing and Fault Resilience with WeaveDNS](/site/weavedns/load-balance-fault-weavedns.md)
|
* [Load Balancing and Fault Resilience with WeaveDNS](/site/weavedns/load-balance-fault-weavedns.md)
|
||||||
* [Managing Domains](/site/weavedns/managing-domains-weavedns.md)
|
* [Managing Domains](/site/weavedns/managing-domains-weavedns.md)
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Troubleshooting and Present Limitations
|
title: Troubleshooting and Present Limitations
|
||||||
menu_order: 50
|
menu_order: 50
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ start_suite "Test CNI plugin"
|
|||||||
cni_connect() {
|
cni_connect() {
|
||||||
pid=$(container_pid $1 $2)
|
pid=$(container_pid $1 $2)
|
||||||
id=$(docker_on $1 inspect -f '{{.Id}}' $2)
|
id=$(docker_on $1 inspect -f '{{.Id}}' $2)
|
||||||
run_on $1 sudo CNI_VERSION=1 CNI_COMMAND=ADD CNI_CONTAINERID=$id CNI_IFNAME=eth0 \
|
run_on $1 sudo CNI_COMMAND=ADD CNI_CONTAINERID=$id CNI_IFNAME=eth0 \
|
||||||
CNI_NETNS=/proc/$pid/ns/net CNI_PATH=/opt/cni/bin /opt/cni/bin/weave-net
|
CNI_NETNS=/proc/$pid/ns/net CNI_PATH=/opt/cni/bin /opt/cni/bin/weave-net
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,11 +16,28 @@ run_on $HOST1 sudo mkdir -p /opt/cni/bin
|
|||||||
weave_on $HOST1 setup-cni
|
weave_on $HOST1 setup-cni
|
||||||
weave_on $HOST1 launch
|
weave_on $HOST1 launch
|
||||||
|
|
||||||
|
C0=$(docker_on $HOST1 run --net=none --name=c0 -dt $SMALL_IMAGE /bin/sh)
|
||||||
C1=$(docker_on $HOST1 run --net=none --privileged --name=c1 -dt $SMALL_IMAGE /bin/sh)
|
C1=$(docker_on $HOST1 run --net=none --privileged --name=c1 -dt $SMALL_IMAGE /bin/sh)
|
||||||
C2=$(docker_on $HOST1 run --net=none --name=c2 -dt $SMALL_IMAGE /bin/sh)
|
C2=$(docker_on $HOST1 run --net=none --name=c2 -dt $SMALL_IMAGE /bin/sh)
|
||||||
|
CH0=$(docker_on $HOST1 run --net=none --name=ch0 -dt $SMALL_IMAGE /bin/sh)
|
||||||
|
CH1=$(docker_on $HOST1 run --net=none --name=ch1 -dt $SMALL_IMAGE /bin/sh)
|
||||||
|
CH2=$(docker_on $HOST1 run --net=none --name=ch2 -dt $SMALL_IMAGE /bin/sh)
|
||||||
|
|
||||||
|
|
||||||
# Enable unsolicited ARPs so that ping after the address reuse does not time out
|
# Enable unsolicited ARPs so that ping after the address reuse does not time out
|
||||||
exec_on $HOST1 c1 sysctl -w net.ipv4.conf.all.arp_accept=1
|
exec_on $HOST1 c1 sysctl -w net.ipv4.conf.all.arp_accept=1
|
||||||
|
|
||||||
|
# Contrived example to trigger the bug in #2839
|
||||||
|
cni_connect $HOST1 c0 <<EOF
|
||||||
|
{
|
||||||
|
"name": "weave",
|
||||||
|
"type": "weave-net",
|
||||||
|
"ipam": {
|
||||||
|
"type": "weave-ipam"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
cni_connect $HOST1 c1 <<EOF
|
cni_connect $HOST1 c1 <<EOF
|
||||||
{
|
{
|
||||||
"name": "weave",
|
"name": "weave",
|
||||||
@@ -30,6 +47,7 @@ EOF
|
|||||||
|
|
||||||
cni_connect $HOST1 c2 <<EOF
|
cni_connect $HOST1 c2 <<EOF
|
||||||
{
|
{
|
||||||
|
"cniVersion": "0.3.0",
|
||||||
"name": "weave",
|
"name": "weave",
|
||||||
"type": "weave-net",
|
"type": "weave-net",
|
||||||
"ipam": {
|
"ipam": {
|
||||||
@@ -39,9 +57,39 @@ cni_connect $HOST1 c2 <<EOF
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# examples to test hairpin
|
||||||
|
cni_connect $HOST1 ch0 <<EOF
|
||||||
|
{
|
||||||
|
"name": "weave",
|
||||||
|
"type": "weave-net",
|
||||||
|
"hairpinMode": true
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
cni_connect $HOST1 ch1 <<EOF
|
||||||
|
{
|
||||||
|
"name": "weave",
|
||||||
|
"type": "weave-net",
|
||||||
|
"hairpinMode": false
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
cni_connect $HOST1 ch2 <<EOF
|
||||||
|
{
|
||||||
|
"name": "weave",
|
||||||
|
"type": "weave-net"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
C0IP=$(container_ip $HOST1 c0)
|
||||||
C1IP=$(container_ip $HOST1 c1)
|
C1IP=$(container_ip $HOST1 c1)
|
||||||
C2IP=$(container_ip $HOST1 c2)
|
C2IP=$(container_ip $HOST1 c2)
|
||||||
|
|
||||||
|
# Check the bridge IP is different from the container IPs
|
||||||
|
BRIP=$(container_ip $HOST1 weave:expose)
|
||||||
|
assert_raises "[ $BRIP != $C0IP ]"
|
||||||
|
assert_raises "[ $BRIP != $C1IP ]"
|
||||||
|
assert_raises "[ $BRIP != $C2IP ]"
|
||||||
|
|
||||||
assert_raises "exec_on $HOST1 c1 $PING $C2IP"
|
assert_raises "exec_on $HOST1 c1 $PING $C2IP"
|
||||||
assert_raises "exec_on $HOST1 c2 $PING $C1IP"
|
assert_raises "exec_on $HOST1 c2 $PING $C1IP"
|
||||||
# Check if the route to the outside world works
|
# Check if the route to the outside world works
|
||||||
@@ -62,8 +110,32 @@ C3IP=$(container_ip $HOST1 c3)
|
|||||||
|
|
||||||
# CNI shouldn't re-use the address until we call DEL
|
# CNI shouldn't re-use the address until we call DEL
|
||||||
assert_raises "[ $C2IP != $C3IP ]"
|
assert_raises "[ $C2IP != $C3IP ]"
|
||||||
|
assert_raises "[ $BRIP != $C3IP ]"
|
||||||
assert_raises "exec_on $HOST1 c1 $PING $C3IP"
|
assert_raises "exec_on $HOST1 c1 $PING $C3IP"
|
||||||
|
|
||||||
|
#####
|
||||||
|
#
|
||||||
|
# Hairpin mode tests
|
||||||
|
#
|
||||||
|
# here we check that the bridge side of the veth is set to hairpin mode (true or false) correctly
|
||||||
|
# check for each of
|
||||||
|
# - ch0 explicitly true
|
||||||
|
# - ch1 explicitly false
|
||||||
|
# - ch2 unset, which should default to true
|
||||||
|
#
|
||||||
|
# we take advantage of the veth name being constructed from the container ID)
|
||||||
|
#
|
||||||
|
# should this reliance ever fail and we need to get it from the system, do the following for each:
|
||||||
|
# CH0_PEER_ID=$(exec_on $HOST1 ch0 cat /sys/class/net/eth0/iflink)
|
||||||
|
# CH0_PEER=$($SSH $HOST1 ip link show | awk "/^${CH0_PEER_ID}:/"' {print $2}' | sed 's/@.*$//g' )
|
||||||
|
# CH0_HAIRPIN=$($SSH $HOST1 cat /sys/devices/virtual/net/weave/brif/$CH0_PEER/hairpin_mode)
|
||||||
|
# assert_raises "[ $CH0_HAIRPIN == 1 ]"
|
||||||
|
#
|
||||||
|
assert "$SSH $HOST1 cat /sys/devices/virtual/net/weave/brif/vethwepl${CH0:0:7}/hairpin_mode" "1"
|
||||||
|
assert "$SSH $HOST1 cat /sys/devices/virtual/net/weave/brif/vethwepl${CH1:0:7}/hairpin_mode" "0"
|
||||||
|
assert "$SSH $HOST1 cat /sys/devices/virtual/net/weave/brif/vethwepl${CH2:0:7}/hairpin_mode" "1"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Ensure existing containers can reclaim their IP addresses after CNI has been used -- see #2548
|
# Ensure existing containers can reclaim their IP addresses after CNI has been used -- see #2548
|
||||||
stop_weave_on $HOST1
|
stop_weave_on $HOST1
|
||||||
|
|||||||
@@ -20,7 +20,15 @@ SUCCESS="6 established"
|
|||||||
|
|
||||||
tear_down_kubeadm
|
tear_down_kubeadm
|
||||||
|
|
||||||
run_on $HOST1 "sudo systemctl start kubelet && sudo kubeadm init --token=$TOKEN"
|
# Make an ipset, so we can check it doesn't get wiped out by Weave Net
|
||||||
|
docker_on $HOST1 run --rm --privileged --net=host --entrypoint=/usr/sbin/ipset weaveworks/weave-npc create test_840_ipset bitmap:ip range 192.168.1.0/24 || true
|
||||||
|
docker_on $HOST1 run --rm --privileged --net=host --entrypoint=/usr/sbin/ipset weaveworks/weave-npc add test_840_ipset 192.168.1.11
|
||||||
|
|
||||||
|
# kubeadm init upgrades to latest Kubernetes version by default, therefore we try to lock the version using the below option:
|
||||||
|
k8s_version="$(run_on $HOST1 "kubelet --version" | grep -oP "(?<=Kubernetes )v[\d\.\-beta]+")"
|
||||||
|
k8s_version_option="$([[ "$k8s_version" > "v1.6" ]] && echo "kubernetes-version" || echo "use-kubernetes-version")"
|
||||||
|
|
||||||
|
run_on $HOST1 "sudo systemctl start kubelet && sudo kubeadm init --$k8s_version_option=$k8s_version --token=$TOKEN"
|
||||||
run_on $HOST2 "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN $HOST1IP"
|
run_on $HOST2 "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN $HOST1IP"
|
||||||
run_on $HOST3 "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN $HOST1IP"
|
run_on $HOST3 "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN $HOST1IP"
|
||||||
|
|
||||||
@@ -52,6 +60,11 @@ assert_raises "run_on $HOST1 $PING $HOST2EXPIP"
|
|||||||
assert_raises "run_on $HOST2 $PING $HOST1EXPIP"
|
assert_raises "run_on $HOST2 $PING $HOST1EXPIP"
|
||||||
assert_raises "run_on $HOST3 $PING $HOST2EXPIP"
|
assert_raises "run_on $HOST3 $PING $HOST2EXPIP"
|
||||||
|
|
||||||
|
# Ensure we do not generate any defunct process (e.g. launch.sh) after starting weaver:
|
||||||
|
assert "run_on $HOST1 ps aux | grep -c '[d]efunct'" "0"
|
||||||
|
assert "run_on $HOST2 ps aux | grep -c '[d]efunct'" "0"
|
||||||
|
assert "run_on $HOST3 ps aux | grep -c '[d]efunct'" "0"
|
||||||
|
|
||||||
# See if we can get some pods running that connect to the network
|
# See if we can get some pods running that connect to the network
|
||||||
run_on $HOST1 "kubectl run hello --image=weaveworks/hello-world --replicas=3"
|
run_on $HOST1 "kubectl run hello --image=weaveworks/hello-world --replicas=3"
|
||||||
|
|
||||||
@@ -71,4 +84,7 @@ assert_raises wait_for_pods
|
|||||||
|
|
||||||
tear_down_kubeadm
|
tear_down_kubeadm
|
||||||
|
|
||||||
|
# Destroy our test ipset, and implicitly check it is still there
|
||||||
|
assert_raises "docker_on $HOST1 run --rm --privileged --net=host --entrypoint=/usr/sbin/ipset weaveworks/weave-npc destroy test_840_ipset"
|
||||||
|
|
||||||
end_suite
|
end_suite
|
||||||
+1
-1
@@ -2,7 +2,7 @@ This directory contains integration tests for weave.
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
You need three VMs with `docker` (`>=1.6.0`) installed and listening on TCP
|
You need three VMs with `docker` (`>=1.10.0`) installed and listening on TCP
|
||||||
port `2375` (see below). You also need to be able to SSH to these VMs without
|
port `2375` (see below). You also need to be able to SSH to these VMs without
|
||||||
having to input anything.
|
having to input anything.
|
||||||
|
|
||||||
|
|||||||
Loaded 100 of 108 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user