Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
041b6fe251 | ||
|
|
d128488339 | ||
|
|
c8c61adca4 | ||
|
|
7c8f33f525 | ||
|
|
15bf6eab1e | ||
|
|
10333b0f3e | ||
|
|
52a5ca8f88 | ||
|
|
b19f2df6f8 | ||
|
|
b3ac56e3d2 | ||
|
|
cc77ad2c65 | ||
|
|
24c2743a58 | ||
|
|
b49f5bdb99 | ||
|
|
28a1578d20 | ||
|
|
e78be1fc35 | ||
|
|
402fe094f4 | ||
|
|
1c1b3248c0 | ||
|
|
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 | ||
|
|
125f3cf6f6 | ||
|
|
b2ffe77029 | ||
|
|
3607cf2d7a | ||
|
|
a57cf4bc83 | ||
|
|
6036037817 | ||
|
|
242b8907bf | ||
|
|
9db22c3cd6 | ||
|
|
e57d79bd70 | ||
|
|
589ab4f01d | ||
|
|
01fe09065c | ||
|
|
83958561f7 | ||
|
|
cb73cf3f51 | ||
|
|
7a3e8e64b7 | ||
|
|
f7ce16cba8 | ||
|
|
6ac1fef01d | ||
|
|
5c19efae48 | ||
|
|
f7c0da3ae1 | ||
|
|
fe0c833cdf | ||
|
|
58342f7509 | ||
|
|
fad537cad7 | ||
|
|
6d5c2ad0fa | ||
|
|
b585e1f4cb | ||
|
|
7102bf6d9d | ||
|
|
77988012ed | ||
|
|
2989e3cccd | ||
|
|
5a47d1d13f | ||
|
|
d3795d4e74 | ||
|
|
bc97daf5c0 | ||
|
|
08e4c98172 | ||
|
|
ca254e066a | ||
|
|
aea92a3563 | ||
|
|
e9fa655e0e | ||
|
|
7d178ecee9 | ||
|
|
201321f390 | ||
|
|
3afc528c88 | ||
|
|
62c9522bf6 | ||
|
|
1b45e8662e | ||
|
|
3ce8aec039 | ||
|
|
32d44e09a1 | ||
|
|
4e37f5ec42 | ||
|
|
39f471e9d3 | ||
|
|
293abd953e | ||
|
|
fde7dcdde9 | ||
|
|
7075b5d9fd | ||
|
|
50b1aa0c74 | ||
|
|
7f48cc9239 | ||
|
|
8211afe5d5 | ||
|
|
e26dbf11e9 | ||
|
|
39ac1a0037 | ||
|
|
86f716c38c | ||
|
|
d5c7c4476b | ||
|
|
2a02883f07 | ||
|
|
f592e4b70a | ||
|
|
968855e0a4 | ||
|
|
bee031ad70 | ||
|
|
3378e09b6a | ||
|
|
ab37b4a6c4 | ||
|
|
dff5b6d3f1 | ||
|
|
c026579cec | ||
|
|
ef8b576742 | ||
|
|
69398a9d7e | ||
|
|
0a2beedad3 | ||
|
|
29d50bbf09 | ||
|
|
673fc73cd5 | ||
|
|
1185bed370 | ||
|
|
1176d44044 | ||
|
|
77649ab81b | ||
|
|
a51bc6164c | ||
|
|
dd935b7e9e | ||
|
|
67dbdd377c | ||
|
|
e5185e73ce | ||
|
|
17ada094f8 | ||
|
|
3e5593dc4f | ||
|
|
e647fe6331 | ||
|
|
a2679794b3 | ||
|
|
30f59953d2 | ||
|
|
acd16881d9 | ||
|
|
2aaa400d62 | ||
|
|
487ebfb514 | ||
|
|
fde7e88e66 | ||
|
|
9e4ce8c052 | ||
|
|
defa5cc3d3 | ||
|
|
dea2755161 | ||
|
|
cc8785fdcf | ||
|
|
7265c6ea03 | ||
|
|
0792f0717d |
No files matched your search
@@ -68,3 +68,5 @@ test/tls/*.pem
|
|||||||
test/coverage
|
test/coverage
|
||||||
test/coverage.*
|
test/coverage.*
|
||||||
*qemu-*-static
|
*qemu-*-static
|
||||||
|
terraform.tfstate
|
||||||
|
terraform.tfstate.backup
|
||||||
+4
-4
@@ -3,7 +3,7 @@
|
|||||||
url = https://github.com/weaveworks/build-tools
|
url = https://github.com/weaveworks/build-tools
|
||||||
[submodule "vendor/github.com/vishvananda/netlink"]
|
[submodule "vendor/github.com/vishvananda/netlink"]
|
||||||
path = vendor/github.com/vishvananda/netlink
|
path = vendor/github.com/vishvananda/netlink
|
||||||
url = https://github.com/weaveworks/netlink.git
|
url = https://github.com/vishvananda/netlink.git
|
||||||
[submodule "vendor/github.com/gorilla/mux"]
|
[submodule "vendor/github.com/gorilla/mux"]
|
||||||
path = vendor/github.com/gorilla/mux
|
path = vendor/github.com/gorilla/mux
|
||||||
url = https://github.com/gorilla/mux.git
|
url = https://github.com/gorilla/mux.git
|
||||||
@@ -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
|
||||||
+22
-3
@@ -1,8 +1,27 @@
|
|||||||
# IMPORTANT: Please only use GLOBs to ignore files and directories.
|
# IMPORTANT: Please only use GLOBs to ignore files and directories.
|
||||||
|
|
||||||
# Do not lint any bash script in Weave Net, in order to
|
# Do not lint the below bash scripts in Weave Net, in order to
|
||||||
# avoid breaking the build on make lint:
|
# avoid breaking the build on make lint:
|
||||||
*.sh
|
bin/circle-deploy-issues
|
||||||
bin/*
|
bin/circle-deploy-master
|
||||||
|
bin/circle-teardown-pre
|
||||||
|
bin/circle-test-teardown
|
||||||
|
bin/circle-test-unit
|
||||||
|
bin/install-wordepress
|
||||||
|
bin/multiweave
|
||||||
|
bin/publish-site
|
||||||
|
bin/release
|
||||||
|
build/build.sh
|
||||||
|
prog/weave-kube/launch.sh
|
||||||
prog/weaveexec/symlink
|
prog/weaveexec/symlink
|
||||||
|
test/*_test.sh
|
||||||
|
test/600_proxy_docker_py.sh
|
||||||
|
test/assert.sh
|
||||||
|
test/config.sh
|
||||||
|
test/gce.sh
|
||||||
|
test/gen_coverage_reports.sh
|
||||||
|
test/run_all.sh
|
||||||
|
test/sanity_check.sh
|
||||||
|
test/setup.sh
|
||||||
|
vendor/*.sh
|
||||||
weave
|
weave
|
||||||
@@ -1,3 +1,87 @@
|
|||||||
|
## 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
|
||||||
|
|
||||||
|
Bug fixes and minor improvements
|
||||||
|
|
||||||
|
* Fix a weave-kube bug when `br_netfilter` or `xt_set` module is compiled into
|
||||||
|
kernel #2820/#2821
|
||||||
|
* Detect the absence of the required `xt_set` kernel module #2821
|
||||||
|
|
||||||
|
## Release 1.9.1
|
||||||
|
|
||||||
|
Bug fixes and minor improvements
|
||||||
|
|
||||||
|
* Fix a race condition when the Weave Net container is restarted
|
||||||
|
which could allow a new container to be allocated the same IP
|
||||||
|
address as an existing one #2784,#2787
|
||||||
|
* Handle the message type received when a pod has been deleted during
|
||||||
|
Kubernetes api-server fail-over #2772,#2773
|
||||||
|
* Make weave-kube work with `dockerd --iptables=false` #2726
|
||||||
|
* Ensure we have the right kernel modules loaded for Network Policy in weave-kube #2819
|
||||||
|
* Reference-count addresses in Network Policy Controller, to avoid
|
||||||
|
errors when updates come in an unexpected order #2792,#2795
|
||||||
|
* Allow the soft connection limit to be raised in weave-kube, so
|
||||||
|
larger clusters can be created #2781
|
||||||
|
* WeaveDNS was incorrectly case-sensitive for reverse DNS lookups #2817,#2818
|
||||||
|
|
||||||
|
Build and Testing
|
||||||
|
|
||||||
|
* Scripts to create VMs to run automated tests were rewritten to use
|
||||||
|
Terraform and Ansible, to make it much easier to test with different
|
||||||
|
versions of components such as Docker and Kubernetes #2647,#2694,#2775,#2796
|
||||||
|
* Upgrade to latest Weaveworks common build-tools #2780
|
||||||
|
* Improve encryption tests #2793
|
||||||
|
* Update vishvananda/netlink library to bring in changes we had previously forked #2790
|
||||||
|
* Slight change to the build container to avoid permission errors and slow builds #2761,#2802
|
||||||
|
|
||||||
## Release 1.9.0
|
## Release 1.9.0
|
||||||
|
|
||||||
Highlights:
|
Highlights:
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
DOCKER_VERSION=1.11.2
|
||||||
|
KUBERNETES_VERSION=1.5.2
|
||||||
|
KUBERNETES_CNI_VERSION=0.3.0.1
|
||||||
@@ -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 \
|
||||||
@@ -214,7 +216,7 @@ tests:
|
|||||||
./tools/test -no-go-get -netgo -timeout 8m
|
./tools/test -no-go-get -netgo -timeout 8m
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
./tools/lint -nocomment -notestpackage .
|
./tools/lint -nocomment -notestpackage
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -359,3 +361,20 @@ build:
|
|||||||
|
|
||||||
run-smoketests: all testrunner
|
run-smoketests: all testrunner
|
||||||
cd test && ./setup.sh && ./run_all.sh
|
cd test && ./setup.sh && ./run_all.sh
|
||||||
|
|
||||||
|
integration-tests: all testrunner
|
||||||
|
# Usage:
|
||||||
|
# $ make \
|
||||||
|
# NAME="<prefix used to name VMs and other resources>" \
|
||||||
|
# PROVIDER="<provider among {vagrant|gcp|aws|do}>" \
|
||||||
|
# NUM_HOSTS="<# test machines>" \
|
||||||
|
# PLAYBOOK="<filename>" \
|
||||||
|
# RUNNER_ARGS="<...>" \
|
||||||
|
# TESTS="<...>" \ # Can be set to only run one or a few tests instead of the full test suite.
|
||||||
|
# DOCKER_VERSION=<...> \
|
||||||
|
# KUBERNETES_VERSION=<...> \
|
||||||
|
# KUBERNETES_CNI_VERSION=<...> \
|
||||||
|
# <...> # See also run-integration-test.sh for all variables and individual functions.
|
||||||
|
# integration-tests
|
||||||
|
#
|
||||||
|
RUNNER_ARGS="-parallel" ./test/run-integration-tests.sh
|
||||||
@@ -23,5 +23,20 @@ Weave Net creates a virtual network that connects Docker containers across multi
|
|||||||
|
|
||||||
Services provided by application containers on the Weave network can be exposed to the outside world, regardless of where they are running. Similarly, existing internal systems can be opened to accept connections from application containers irrespective of their location.
|
Services provided by application containers on the Weave network can be exposed to the outside world, regardless of where they are running. Similarly, existing internal systems can be opened to accept connections from application containers irrespective of their location.
|
||||||
|
|
||||||
* [Install Weave Net](https://www.weave.works/docs/net/latest/installing-weave/)
|
## <a name="help"></a>Getting help
|
||||||
* [Find out more about Weave Net](https://www.weave.works/products/weave-net/)
|
|
||||||
|
If you have any questions about, feedback for or a problem with Weave Net:
|
||||||
|
|
||||||
|
- Read [the Weave Net docs](https://www.weave.works/docs/net/latest/introducing-weave/).
|
||||||
|
- Invite yourself to the <a href="https://weaveworks.github.io/community-slack/" target="_blank"> #weave-community </a> slack channel.
|
||||||
|
- Ask a question on the <a href="https://weave-community.slack.com/messages/general/"> #weave-community</a> slack channel.
|
||||||
|
- Join the <a href="https://www.meetup.com/pro/Weave/"> Weave User Group </a> and get invited to online talks, hands-on training and meetups in your area.
|
||||||
|
- Send an email to <a href="mailto:weave-users@weave.works">weave-users@weave.works</a>
|
||||||
|
- <a href="https://github.com/weaveworks/weave/issues/new">File an issue.</a>
|
||||||
|
|
||||||
|
Your feedback is always welcome!
|
||||||
|
|
||||||
|
##Further Information
|
||||||
|
|
||||||
|
* [Installing Weave Net](https://www.weave.works/docs/net/latest/installing-weave/)
|
||||||
|
* [Weave Net Product Overview](https://www.weave.works/products/weave-net/)
|
||||||
Vendored
+15
-24
@@ -1,45 +1,36 @@
|
|||||||
VAGRANTFILE_API_VERSION = "2"
|
require File.expand_path(File.join(File.dirname(__FILE__), 'vagrant-common.rb'))
|
||||||
|
|
||||||
require './vagrant-common.rb'
|
|
||||||
|
|
||||||
vm_ip = "172.16.0.3" # arbitrary private IP
|
vm_ip = "172.16.0.3" # arbitrary private IP
|
||||||
|
|
||||||
pkgs = %w(
|
|
||||||
docker-engine=1.10.2-0~wily
|
|
||||||
aufs-tools
|
|
||||||
build-essential
|
|
||||||
ethtool
|
|
||||||
iputils-arping
|
|
||||||
libpcap-dev
|
|
||||||
git
|
|
||||||
mercurial
|
|
||||||
bc
|
|
||||||
jq
|
|
||||||
)
|
|
||||||
|
|
||||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
|
|
||||||
config.vm.box = "ubuntu/wily64"
|
config.vm.box = VAGRANT_IMAGE
|
||||||
|
|
||||||
config.vm.network "private_network", ip: vm_ip
|
config.vm.network "private_network", ip: vm_ip
|
||||||
config.vm.provider :virtualbox do |vb|
|
config.vm.provider :virtualbox do |vb|
|
||||||
vb.memory = 2048
|
vb.memory = 2048
|
||||||
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "off"]
|
configure_nat_dns(vb)
|
||||||
vb.customize ["modifyvm", :id, "--natdnsproxy1", "off"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Disable default Vagrant shared folder, which we don't need:
|
||||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||||
|
# Keep Weave Net sources' in sync:
|
||||||
config.vm.synced_folder ".", "/home/vagrant/src/github.com/weaveworks/weave"
|
config.vm.synced_folder ".", "/home/vagrant/src/github.com/weaveworks/weave"
|
||||||
|
# Create a convenience symlink to $HOME/src/github.com/weaveworks/weave
|
||||||
|
config.vm.provision :shell, :inline => 'ln -sf ~vagrant/src/github.com/weaveworks/weave ~vagrant/'
|
||||||
|
|
||||||
# Set SSH keys up to be able to run smoke tests straightaway:
|
# Set SSH keys up to be able to run smoke tests straightaway:
|
||||||
config.vm.provision "file", source: "~/.vagrant.d/insecure_private_key", destination: "/home/vagrant/src/github.com/weaveworks/weave/test/insecure_private_key"
|
config.vm.provision "file", source: "~/.vagrant.d/insecure_private_key", destination: "/home/vagrant/src/github.com/weaveworks/weave/test/insecure_private_key"
|
||||||
|
# Grant permissions on sources:
|
||||||
install_build_deps config.vm, pkgs
|
config.vm.provision :shell, :inline => 'sudo chown -R vagrant:vagrant ~vagrant/src', :privileged => false
|
||||||
install_go_toochain config.vm
|
|
||||||
tweak_user_env config.vm
|
|
||||||
tweak_docker_daemon config.vm
|
|
||||||
cleanup config.vm
|
cleanup config.vm
|
||||||
|
|
||||||
|
config.vm.provision 'ansible' do |ansible|
|
||||||
|
ansible.playbook = 'tools/config_management/setup_weave-net_dev.yml'
|
||||||
|
ansible.extra_vars = {
|
||||||
|
go_version: GO_VERSION
|
||||||
|
}.merge(ansibleize(get_dependencies_version_from_file_and_env()))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|||||||
@@ -2,45 +2,16 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "TEST_AND_PUBLISH=1" > "$STATE"
|
|
||||||
|
|
||||||
# Avoid doing a full build if we can. Note if the PR doesn't exist
|
|
||||||
# when the build is kicked off, we can't run this check so we do a
|
|
||||||
# full build. Subsequent pushes to the same branch will have the desired behaviour
|
|
||||||
if [ -n "$CI_PULL_REQUEST" -a "$CI_PULL_REQUEST" = "$CI_PULL_REQUESTS" ] ; then
|
|
||||||
if PR=$(echo "$CI_PULL_REQUEST" | grep -oP '(?<=^https://github.com/weaveworks/weave/pull/)[0-9]+$') ; then
|
|
||||||
echo "GH_PR=$PR" >> "$STATE"
|
|
||||||
if FILES=$(curl -s https://api.github.com/repos/weaveworks/weave/pulls/$PR/files | jq -r '.[]|.filename') ; then
|
|
||||||
echo "PR touches [$FILES]"
|
|
||||||
if ! echo "$FILES" | grep -v ^site/ ; then
|
|
||||||
echo "PR contains site changes only - skipping tests"
|
|
||||||
echo "TEST_AND_PUBLISH=" >> "$STATE"
|
|
||||||
else
|
|
||||||
echo "PR contains non-site changes - running tests"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Unable to get files for PR $PR" >&2
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Unable to extract PR number from $CI_PULL_REQUEST" >&2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
source "$STATE"
|
source "$STATE"
|
||||||
|
|
||||||
mkdir -p $(dirname $SRCDIR) && cp -r $(pwd)/ $SRCDIR
|
|
||||||
|
|
||||||
if [ -n "$TEST_AND_PUBLISH" ]; then
|
if [ -n "$TEST_AND_PUBLISH" ]; then
|
||||||
[ -z "$SECRET_PASSWORD" ] || bin/setup-circleci-secrets "$SECRET_PASSWORD"
|
cd "$SRCDIR"
|
||||||
cd $SRCDIR; git submodule update --init
|
git submodule update --init
|
||||||
if [ "$CIRCLE_NODE_INDEX" = "0" -a -n "$SECRET_PASSWORD" ] ; then
|
cd "$SRCDIR/build"
|
||||||
cd $SRCDIR/test; ./gce.sh make_template
|
|
||||||
fi
|
|
||||||
cd $SRCDIR/build
|
|
||||||
../tools/rebuild-image weaveworks/weavebuild . Dockerfile build.sh
|
../tools/rebuild-image weaveworks/weavebuild . Dockerfile build.sh
|
||||||
touch $SRCDIR/.build.uptodate
|
touch "$SRCDIR/.build.uptodate"
|
||||||
sudo chown -R ubuntu /usr/local/go
|
sudo chown -R ubuntu /usr/local/go
|
||||||
cd $SRCDIR
|
cd "$SRCDIR"
|
||||||
make testrunner
|
make testrunner
|
||||||
make COVERAGE=true RM= exes all
|
make COVERAGE=true RM= exes all
|
||||||
fi
|
fi
|
||||||
Executable
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "TEST_AND_PUBLISH=1" >"$STATE"
|
||||||
|
|
||||||
|
# Avoid doing a full build if we can. Note if the PR doesn't exist
|
||||||
|
# when the build is kicked off, we can't run this check so we do a
|
||||||
|
# full build. Subsequent pushes to the same branch will have the desired behaviour
|
||||||
|
if [ -n "$CI_PULL_REQUEST" -a "$CI_PULL_REQUEST" = "$CI_PULL_REQUESTS" ]; then
|
||||||
|
if PR=$(echo "$CI_PULL_REQUEST" | grep -oP '(?<=^https://github.com/weaveworks/weave/pull/)[0-9]+$'); then
|
||||||
|
echo "GH_PR=$PR" >>"$STATE"
|
||||||
|
if FILES=$(curl -s "https://api.github.com/repos/weaveworks/weave/pulls/$PR/files" | jq -r '.[]|.filename'); then
|
||||||
|
echo "PR touches [$FILES]"
|
||||||
|
if ! echo "$FILES" | grep -v ^site/; then
|
||||||
|
echo "PR contains site changes only - skipping tests"
|
||||||
|
echo "TEST_AND_PUBLISH=" >>"$STATE"
|
||||||
|
else
|
||||||
|
echo "PR contains non-site changes - running tests"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Unable to get files for PR $PR" >&2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Unable to extract PR number from $CI_PULL_REQUEST" >&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$STATE"
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "$SRCDIR")" && cp -r "$(pwd)/" "$SRCDIR"
|
||||||
|
|
||||||
|
if [ -n "$TEST_AND_PUBLISH" ]; then
|
||||||
|
cd "$SRCDIR"
|
||||||
|
git submodule update --init
|
||||||
|
fi
|
||||||
+22
-2
@@ -2,9 +2,29 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Signal failures in lock file, in order to fail fast:
|
||||||
|
function signal_failure() {
|
||||||
|
echo "KO" >"$TEST_VMS_READY_LOCK_FILE"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
trap signal_failure ERR
|
||||||
|
|
||||||
source "$STATE"
|
source "$STATE"
|
||||||
|
source "$(dirname "$0")/wait_for.sh"
|
||||||
|
|
||||||
if [ -n "$TEST_AND_PUBLISH" ]; then
|
if [ -n "$TEST_AND_PUBLISH" ]; then
|
||||||
cd $SRCDIR/test
|
[ -n "$SECRET_KEY" ] || {
|
||||||
[ -z "$SECRET_PASSWORD" ] || (./gce.sh setup && eval $(./gce.sh hosts) && ./setup.sh)
|
echo "Cannot run smoke tests: no secret key"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Provisioning from image typically take 90 seconds,
|
||||||
|
# but if we are creating a GCP image, it can take more than 10 minutes:
|
||||||
|
wait_for 900 "$TEST_VMS_PROV_AND_CONF_LOCK_FILE"
|
||||||
|
|
||||||
|
# Upload built binaries to testing VMs:
|
||||||
|
cd "$SRCDIR/test" # Ensures we generate Terraform state files in the right folder, for later use by integration tests.
|
||||||
|
./run-integration-tests.sh setup >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1
|
||||||
|
echo "OK" >"$TEST_VMS_READY_LOCK_FILE"
|
||||||
|
echo "Test VMs now ready. $(date)." >>"$TEST_VMS_SETUP_OUTPUT_FILE"
|
||||||
fi
|
fi
|
||||||
+13
-4
@@ -3,12 +3,21 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source "$STATE"
|
source "$STATE"
|
||||||
|
source "$(dirname "$0")/wait_for.sh"
|
||||||
|
|
||||||
if [ -n "$TEST_AND_PUBLISH" ]; then
|
if [ -n "$TEST_AND_PUBLISH" ]; then
|
||||||
[ -n "$SECRET_PASSWORD" ] || { echo "Cannot run smoke tests: no secret key"; exit 1; }
|
[ -n "$SECRET_KEY" ] || {
|
||||||
cd $SRCDIR/test
|
echo "Cannot run smoke tests: no secret key"
|
||||||
eval $(./gce.sh hosts)
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Provisioning from image typically take 90 seconds,
|
||||||
|
# but if we are creating a GCP image, it can take more than 10 minutes:
|
||||||
|
wait_for 900 "$TEST_VMS_READY_LOCK_FILE"
|
||||||
|
|
||||||
|
# Run integration tests:
|
||||||
export COVERAGE=true
|
export COVERAGE=true
|
||||||
export WEAVE_NET_SANITY_CHECKS_FILES="$CIRCLE_ARTIFACTS/weave_net_sanity_check_*.log"
|
export WEAVE_NET_SANITY_CHECKS_FILES="$CIRCLE_ARTIFACTS/weave_net_sanity_check_*.log"
|
||||||
./run_all.sh
|
cd "$SRCDIR/test" # Ensures we generate code coverage files in the right folder, and use the Terraform state of previously provisionned VMs.
|
||||||
|
./run-integration-tests.sh test
|
||||||
fi
|
fi
|
||||||
@@ -6,6 +6,5 @@ source "$STATE"
|
|||||||
|
|
||||||
if [ -n "$TEST_AND_PUBLISH" ] ; then
|
if [ -n "$TEST_AND_PUBLISH" ] ; then
|
||||||
cd $SRCDIR/test
|
cd $SRCDIR/test
|
||||||
[ -z "$SECRET_PASSWORD" ] || ./gce.sh destroy
|
|
||||||
test "$CIRCLE_NODE_INDEX" != "0" || (cd $SRCDIR/test; ./gen_coverage_reports.sh)
|
test "$CIRCLE_NODE_INDEX" != "0" || (cd $SRCDIR/test; ./gen_coverage_reports.sh)
|
||||||
fi
|
fi
|
||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Signal failures in lock file, in order to fail fast:
|
||||||
|
function signal_failure() {
|
||||||
|
echo "KO" >"$TEST_VMS_PROV_AND_CONF_LOCK_FILE"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
trap signal_failure ERR
|
||||||
|
|
||||||
|
source "$STATE"
|
||||||
|
|
||||||
|
function install_terraform() {
|
||||||
|
curl -fsS https://releases.hashicorp.com/terraform/0.8.5/terraform_0.8.5_linux_amd64.zip | gunzip >terraform && chmod +x terraform && sudo mv terraform /usr/bin
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_ansible() {
|
||||||
|
sudo apt-get update || true
|
||||||
|
sudo apt-get install -qq -y python-pip python-dev libffi-dev libssl-dev && pip install --user -U cffi && pip install --user ansible
|
||||||
|
export PATH="$PATH:$HOME/.local/bin"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -n "$TEST_AND_PUBLISH" ]; then
|
||||||
|
[ -n "$SECRET_KEY" ] || {
|
||||||
|
echo "Cannot run smoke tests: no secret key"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
install_terraform >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1
|
||||||
|
install_ansible >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1
|
||||||
|
|
||||||
|
# Only attempt to create GCP image in first container, wait for it to be created otherwise:
|
||||||
|
[ "$CIRCLE_NODE_INDEX" != "0" ] && export CREATE_IMAGE=0
|
||||||
|
|
||||||
|
# Provision and configure testing VMs:
|
||||||
|
cd "$SRCDIR/test" # Ensures we generate Terraform state files in the right folder, for later use by integration tests.
|
||||||
|
./run-integration-tests.sh configure >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1
|
||||||
|
echo "OK" >"$TEST_VMS_PROV_AND_CONF_LOCK_FILE"
|
||||||
|
echo "Test VMs now provisioned and configured. $(date)." >>"$TEST_VMS_SETUP_OUTPUT_FILE"
|
||||||
|
fi
|
||||||
+8
-34
@@ -89,6 +89,8 @@ build() {
|
|||||||
## Inject the version numbers and build the distributables
|
## Inject the version numbers and build the distributables
|
||||||
## (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-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
|
||||||
@@ -157,17 +159,9 @@ draft() {
|
|||||||
--name "weave" \
|
--name "weave" \
|
||||||
--file "./weave"
|
--file "./weave"
|
||||||
|
|
||||||
github-release release $RELEASE_ARGS \
|
|
||||||
--user $GITHUB_USER \
|
|
||||||
--repo weave-kube \
|
|
||||||
--tag $LATEST_TAG \
|
|
||||||
--name "$RELEASE_NAME $VERSION" \
|
|
||||||
--description "$RELEASE_DESCRIPTION"
|
|
||||||
|
|
||||||
sed -i -e s/:latest/:$VERSION/ -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset.yaml
|
|
||||||
github-release upload \
|
github-release upload \
|
||||||
--user $GITHUB_USER \
|
--user $GITHUB_USER \
|
||||||
--repo weave-kube \
|
--repo weave \
|
||||||
--tag $LATEST_TAG \
|
--tag $LATEST_TAG \
|
||||||
--name "weave-daemonset.yaml" \
|
--name "weave-daemonset.yaml" \
|
||||||
--file "./prog/weave-kube/weave-daemonset.yaml"
|
--file "./prog/weave-kube/weave-daemonset.yaml"
|
||||||
@@ -176,8 +170,8 @@ draft() {
|
|||||||
--user $GITHUB_USER \
|
--user $GITHUB_USER \
|
||||||
--repo weave \
|
--repo weave \
|
||||||
--tag $LATEST_TAG \
|
--tag $LATEST_TAG \
|
||||||
--name "weave-daemonset.yaml" \
|
--name "weave-daemonset-k8s-1.6.yaml" \
|
||||||
--file "./prog/weave-kube/weave-daemonset.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"
|
||||||
@@ -258,29 +252,9 @@ publish() {
|
|||||||
--name "weave" \
|
--name "weave" \
|
||||||
--file "./weave"
|
--file "./weave"
|
||||||
|
|
||||||
github-release publish \
|
|
||||||
--user $GITHUB_USER \
|
|
||||||
--repo weave-kube \
|
|
||||||
--tag $LATEST_TAG
|
|
||||||
|
|
||||||
if github-release info --user $GITHUB_USER --repo weave-kube \
|
|
||||||
--tag latest_release >/dev/null 2>&1; then
|
|
||||||
github-release delete \
|
|
||||||
--user $GITHUB_USER \
|
|
||||||
--repo weave-kube \
|
|
||||||
--tag latest_release
|
|
||||||
fi
|
|
||||||
|
|
||||||
github-release release \
|
|
||||||
--user $GITHUB_USER \
|
|
||||||
--repo weave-kube \
|
|
||||||
--tag latest_release \
|
|
||||||
--name "$RELEASE_NAME latest ($VERSION)" \
|
|
||||||
--description "[Release Notes](https://github.com/$GITHUB_USER/weave/releases/$LATEST_TAG)"
|
|
||||||
|
|
||||||
github-release upload \
|
github-release upload \
|
||||||
--user $GITHUB_USER \
|
--user $GITHUB_USER \
|
||||||
--repo weave-kube \
|
--repo weave \
|
||||||
--tag latest_release \
|
--tag latest_release \
|
||||||
--name "weave-daemonset.yaml" \
|
--name "weave-daemonset.yaml" \
|
||||||
--file "./prog/weave-kube/weave-daemonset.yaml"
|
--file "./prog/weave-kube/weave-daemonset.yaml"
|
||||||
@@ -289,8 +263,8 @@ publish() {
|
|||||||
--user $GITHUB_USER \
|
--user $GITHUB_USER \
|
||||||
--repo weave \
|
--repo weave \
|
||||||
--tag latest_release \
|
--tag latest_release \
|
||||||
--name "weave-daemonset.yaml" \
|
--name "weave-daemonset-k8s-1.6.yaml" \
|
||||||
--file "./prog/weave-kube/weave-daemonset.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"
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# openssl enc -in do-setup-circleci-secrets.orig -out setup-circleci-secrets.orig -e -aes256 -pass stdin
|
|
||||||
# openssl base64 < setup-circleci-secrets.orig
|
|
||||||
|
|
||||||
openssl base64 -d << EOF \
|
|
||||||
| openssl enc \
|
|
||||||
-out bin/do-setup-circleci-secrets \
|
|
||||||
-d -aes256 -pass pass:$1
|
|
||||||
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
|
|
||||||
EOF
|
|
||||||
|
|
||||||
exec sh bin/do-setup-circleci-secrets
|
|
||||||
Executable
+21
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# shellcheck disable=SC2155
|
||||||
|
wait_for() {
|
||||||
|
local timeout=$1
|
||||||
|
local lock_file=$2
|
||||||
|
for i in $(seq 1 "$timeout"); do
|
||||||
|
if [ -f "$lock_file" ]; then
|
||||||
|
local status="$(cat "$lock_file")"
|
||||||
|
if [ "$status" == "OK" ]; then
|
||||||
|
echo "[$i seconds]: $lock_file found and status: $status." && return
|
||||||
|
else
|
||||||
|
echo "[$i seconds]: $lock_file found and status: $status." && return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if ! ((i % 10)); then echo "[$i seconds]: Waiting for $lock_file to be created..."; fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo "Timed out waiting for test VMs to be ready. See details in: $TEST_VMS_SETUP_OUTPUT_FILE" >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
@@ -45,6 +45,8 @@ RUN apt-get update \
|
|||||||
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/client9/misspell/cmd/misspell
|
github.com/client9/misspell/cmd/misspell
|
||||||
|
|
||||||
# First clean, because we're gonna rebuild the std both with -race enabled and disabled
|
# First clean, because we're gonna rebuild the std both with -race enabled and disabled
|
||||||
@@ -60,6 +62,9 @@ RUN for platform in ${GO_CROSSPLATFORMS}; do \
|
|||||||
GOOS=${platform%/*} GOARCH=${platform##*/} \
|
GOOS=${platform%/*} GOARCH=${platform##*/} \
|
||||||
go install -tags netgo std; done
|
go install -tags netgo std; done
|
||||||
|
|
||||||
|
# Allow full write access to the Go folders for anyone
|
||||||
|
RUN chmod -R a+w /usr/local/go
|
||||||
|
|
||||||
# The libpcap version from Debian packages is 1.6.2, matching that version here although newer versions of libpcap have been released
|
# The libpcap version from Debian packages is 1.6.2, matching that version here although newer versions of libpcap have been released
|
||||||
# We have to cross-compile the libpcap library for the new architectures, that's what we're doing here
|
# We have to cross-compile the libpcap library for the new architectures, that's what we're doing here
|
||||||
ENV LIBPCAP_CROSS_VERSION=1.6.2
|
ENV LIBPCAP_CROSS_VERSION=1.6.2
|
||||||
|
|||||||
@@ -25,7 +25,4 @@ echo "weave:x:$uid:$gid::$WEAVE_SRC:/bin/sh" >>/etc/passwd
|
|||||||
echo "weave:*:::::::" >>/etc/shadow
|
echo "weave:*:::::::" >>/etc/shadow
|
||||||
echo "weave ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
|
echo "weave ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
|
||||||
|
|
||||||
# Allow full write access to the Go folders for the user Weave
|
|
||||||
chown -R $uid:$gid /usr/local/go
|
|
||||||
|
|
||||||
su weave -c "PATH=$PATH make -C $WEAVE_SRC BUILD_IN_CONTAINER=false $*"
|
su weave -c "PATH=$PATH make -C $WEAVE_SRC BUILD_IN_CONTAINER=false $*"
|
||||||
+19
-1
@@ -11,20 +11,34 @@ 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:
|
||||||
|
NAME: test-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX
|
||||||
|
TEST_VMS_SETUP_OUTPUT_FILE: $CIRCLE_ARTIFACTS/test_vms_setup_output.txt
|
||||||
|
TEST_VMS_PROV_AND_CONF_LOCK_FILE: $CIRCLE_ARTIFACTS/test_vms_provisioned_and_configured.txt
|
||||||
|
TEST_VMS_READY_LOCK_FILE: $CIRCLE_ARTIFACTS/test_vms_ready.txt
|
||||||
|
# Google Cloud Platorm images for integration tests:
|
||||||
|
USE_IMAGE: 1
|
||||||
|
DISK_NAME_PREFIX: test-$CIRCLE_BUILD_NUM-0
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
cache_directories:
|
cache_directories:
|
||||||
- "~/docker"
|
- "~/docker"
|
||||||
post:
|
post:
|
||||||
|
- bin/circle-dependencies-post-sources
|
||||||
|
# Provision & configure testing VMs:
|
||||||
|
- "while [ ! -d $SRCDIR ]; do sleep 1; done; $SRCDIR/bin/provision_test_vms.sh":
|
||||||
|
parallel: true
|
||||||
|
background: true
|
||||||
- bin/circle-dependencies-post
|
- bin/circle-dependencies-post
|
||||||
|
|
||||||
test:
|
test:
|
||||||
pre:
|
pre:
|
||||||
- "$SRCDIR/bin/circle-test-pre":
|
- "$SRCDIR/bin/circle-test-pre":
|
||||||
parallel: true
|
parallel: true
|
||||||
|
background: true
|
||||||
override:
|
override:
|
||||||
- "$SRCDIR/bin/circle-test-unit":
|
- "$SRCDIR/bin/circle-test-unit":
|
||||||
parallel: true
|
parallel: true
|
||||||
@@ -37,6 +51,10 @@ test:
|
|||||||
|
|
||||||
teardown:
|
teardown:
|
||||||
pre:
|
pre:
|
||||||
|
# Destroy testing VMs:
|
||||||
|
- "cd $SRCDIR/test && ./run-integration-tests.sh destroy":
|
||||||
|
parallel: true
|
||||||
|
background: true
|
||||||
- "$SRCDIR/bin/circle-teardown-pre":
|
- "$SRCDIR/bin/circle-teardown-pre":
|
||||||
parallel: true
|
parallel: true
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ properties:
|
|||||||
* Data confidentiality.
|
* Data confidentiality.
|
||||||
* Data origin authentication.
|
* Data origin authentication.
|
||||||
* Integrity.
|
* Integrity.
|
||||||
* Anti-replay service.
|
* Anti-replay.
|
||||||
* Limited traffic flow confidentiality.
|
* Limited traffic flow confidentiality as fast datapath VXLAN packets are fully
|
||||||
|
encrypted.
|
||||||
|
|
||||||
## Notation
|
## Notation
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -52,9 +52,9 @@ overlay, which has a more sophisticated dynamic mechanism for coping
|
|||||||
with low path MTUs.
|
with low path MTUs.
|
||||||
|
|
||||||
To avoid triggering this fallback in typical deployments, the datapath
|
To avoid triggering this fallback in typical deployments, the datapath
|
||||||
interface is statically configured with an MTU of 1410 bytes allowing
|
interface is statically configured with an MTU of 1376 bytes allowing
|
||||||
it to work with most underlay network provider MTUs, including GCE at
|
it to work with most underlay network provider MTUs, including GCE at
|
||||||
1460 bytes (the fifty byte difference accommodates the vxlan overhead).
|
1460 bytes (the eighty four byte difference accommodates the encrypted vxlan overhead).
|
||||||
This value can be overridden by setting `WEAVE_MTU` at launch if
|
This value can be overridden by setting `WEAVE_MTU` at launch if
|
||||||
necessary.
|
necessary.
|
||||||
|
|
||||||
|
|||||||
+22
-6
@@ -65,14 +65,30 @@ peer for space:
|
|||||||
- it will continue to ask for space until it receives some, or its
|
- it will continue to ask for space until it receives some, or its
|
||||||
copy of the ring tells it all peers are full in that subnet.
|
copy of the ring tells it all peers are full in that subnet.
|
||||||
|
|
||||||
|
### Data persistence
|
||||||
|
|
||||||
|
Key IPAM data is saved to disk, in a [BoltDB](https://github.com/boltdb/bolt)
|
||||||
|
file, stored within a [data volume container](https://docs.docker.com/engine/userguide/containers/dockervolumes/#creating-and-mounting-a-data-volume-container)
|
||||||
|
named `weavedb`.
|
||||||
|
|
||||||
|
This file is used to persist data for various Weave Net components; for IPAM it contains:
|
||||||
|
|
||||||
|
* the division of the IP allocation range amongst peers, and
|
||||||
|
* allocation of addresses to containers on the local peer,
|
||||||
|
|
||||||
|
so that it is immediately available when the peer restarts.
|
||||||
|
|
||||||
### Claiming an address
|
### Claiming an address
|
||||||
|
|
||||||
If a Weave process is restarted, in most cases it will hear from
|
If a Weave process is restarted,
|
||||||
another peer which ranges it used to own, but it needs to know which
|
|
||||||
individual IP addresses are assigned to containers in order to avoid
|
- if `weavedb` is present, then it loads persisted IPAM data from there, as
|
||||||
giving the same address out in subsequent allocation requests. The
|
described, in the previous section;
|
||||||
weave script invokes the `claim` command in `populate_ipam` to do
|
- else, it learns from other peers which ranges it used to own.
|
||||||
this.
|
|
||||||
|
Weave Net then consults the allocator to know which individual IP addresses
|
||||||
|
are assigned to containers, and therefore avoid giving the same address out in
|
||||||
|
subsequent allocation requests.
|
||||||
|
|
||||||
When the Allocator is told to claim an address, there are four
|
When the Allocator is told to claim an address, there are four
|
||||||
possibilities:
|
possibilities:
|
||||||
|
|||||||
@@ -138,6 +138,8 @@ Finally, for **Mainline** releases only:
|
|||||||
published to https://www.weave.works
|
published to https://www.weave.works
|
||||||
* Add the new version of `weave-net` to the checkpoint system at
|
* Add the new version of `weave-net` to the checkpoint system at
|
||||||
https://checkpoint-api.weave.works/admin
|
https://checkpoint-api.weave.works/admin
|
||||||
|
* File a PR to update the version of the daemonset at
|
||||||
|
https://github.com/kubernetes/kops/tree/master/upup/models/cloudup/resources/addons/networking.weave
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ NetworkPolicy object updates from the k8s API server:
|
|||||||
network policy, containing the IP addresses of all pods in the
|
network policy, containing the IP addresses of all pods in the
|
||||||
namespace whose labels match that selector
|
namespace whose labels match that selector
|
||||||
|
|
||||||
|
IPsets are implemented by the kernel module `xt_set`, without which
|
||||||
|
weave-npc will not work.
|
||||||
|
|
||||||
ipset names are generated deterministically from a string
|
ipset names are generated deterministically from a string
|
||||||
representation of the corresponding label selector. Because ipset
|
representation of the corresponding label selector. Because ipset
|
||||||
names are limited to 31 characters in length, this is done by taking a
|
names are limited to 31 characters in length, this is done by taking a
|
||||||
@@ -94,6 +97,9 @@ The following traffic is NOT affected:
|
|||||||
(e.g. kubelet health checks)
|
(e.g. kubelet health checks)
|
||||||
* Traffic routed from an application container to the internet
|
* Traffic routed from an application container to the internet
|
||||||
|
|
||||||
|
The above mechanism relies on the kernel module `br_netfilter` being
|
||||||
|
loaded and enabled via `/proc/sys/net/bridge/bridge-nf-call-iptables`.
|
||||||
|
|
||||||
See these resources for helpful context:
|
See these resources for helpful context:
|
||||||
|
|
||||||
* http://ebtables.netfilter.org/br_fw_ia/br_fw_ia.html
|
* http://ebtables.netfilter.org/br_fw_ia/br_fw_ia.html
|
||||||
|
|||||||
+2
-2
@@ -14,9 +14,9 @@ type allocateResult struct {
|
|||||||
|
|
||||||
type allocate struct {
|
type allocate struct {
|
||||||
resultChan chan<- allocateResult
|
resultChan chan<- allocateResult
|
||||||
ident string
|
ident string // a container ID, something like "weave:expose", or api.NoContainerID
|
||||||
r address.CIDR // Subnet we are trying to allocate within
|
r address.CIDR // Subnet we are trying to allocate within
|
||||||
isContainer bool
|
isContainer bool // true if ident is a container ID
|
||||||
hasBeenCancelled func() bool
|
hasBeenCancelled func() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+27
-2
@@ -76,6 +76,13 @@ type Allocator struct {
|
|||||||
now func() time.Time
|
now func() time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PreClaims are IP addresses discovered before we could initialize IPAM
|
||||||
|
type PreClaim struct {
|
||||||
|
Ident string // a container ID, something like "weave:expose", or api.NoContainerID
|
||||||
|
IsContainer bool // true if Ident is a container ID
|
||||||
|
Cidr address.CIDR
|
||||||
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
OurName mesh.PeerName
|
OurName mesh.PeerName
|
||||||
OurUID mesh.PeerUID
|
OurUID mesh.PeerUID
|
||||||
@@ -83,6 +90,7 @@ type Config struct {
|
|||||||
Seed []mesh.PeerName
|
Seed []mesh.PeerName
|
||||||
Universe address.CIDR
|
Universe address.CIDR
|
||||||
IsObserver bool
|
IsObserver bool
|
||||||
|
PreClaims []PreClaim
|
||||||
Quorum func() uint
|
Quorum func() uint
|
||||||
Db db.DB
|
Db db.DB
|
||||||
IsKnownPeer func(name mesh.PeerName) bool
|
IsKnownPeer func(name mesh.PeerName) bool
|
||||||
@@ -123,6 +131,12 @@ func NewAllocator(config Config) *Allocator {
|
|||||||
dead: make(map[string]time.Time),
|
dead: make(map[string]time.Time),
|
||||||
now: time.Now,
|
now: time.Now,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alloc.pendingClaims = make([]operation, len(config.PreClaims))
|
||||||
|
for i, c := range config.PreClaims {
|
||||||
|
alloc.pendingClaims[i] = &claim{ident: c.Ident, cidr: c.Cidr}
|
||||||
|
}
|
||||||
|
|
||||||
return alloc
|
return alloc
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,6 +170,9 @@ func (alloc *Allocator) Start() {
|
|||||||
default:
|
default:
|
||||||
alloc.infof("Initialising as observer - awaiting IPAM data from another peer")
|
alloc.infof("Initialising as observer - awaiting IPAM data from another peer")
|
||||||
}
|
}
|
||||||
|
if loadedPersistedData { // do any pre-claims right away
|
||||||
|
alloc.tryOps(&alloc.pendingClaims)
|
||||||
|
}
|
||||||
actionChan := make(chan func(), mesh.ChannelSize)
|
actionChan := make(chan func(), mesh.ChannelSize)
|
||||||
stopChan := make(chan struct{})
|
stopChan := make(chan struct{})
|
||||||
alloc.actionChan = actionChan
|
alloc.actionChan = actionChan
|
||||||
@@ -193,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
|
||||||
@@ -248,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)
|
||||||
@@ -679,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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-2
@@ -168,11 +168,13 @@ func TestAllocatorClaim(t *testing.T) {
|
|||||||
container1 = "abcdef"
|
container1 = "abcdef"
|
||||||
container3 = "b01df00d"
|
container3 = "b01df00d"
|
||||||
universe = "10.0.3.0/24"
|
universe = "10.0.3.0/24"
|
||||||
testAddr1 = "10.0.3.2/24"
|
testAddr1 = "10.0.3.5/24"
|
||||||
testAddr2 = "10.0.4.2/24"
|
testAddr2 = "10.0.4.2/24"
|
||||||
|
testPre = "10.0.3.1/24"
|
||||||
)
|
)
|
||||||
|
|
||||||
allocs, router, subnet := makeNetworkOfAllocators(2, universe)
|
preAddr, _ := address.ParseCIDR(testPre)
|
||||||
|
allocs, router, subnet := makeNetworkOfAllocators(2, universe, []PreClaim{{container1, true, preAddr}})
|
||||||
defer stopNetworkOfAllocators(allocs, router)
|
defer stopNetworkOfAllocators(allocs, router)
|
||||||
alloc := allocs[1]
|
alloc := allocs[1]
|
||||||
addr1, _ := address.ParseCIDR(testAddr1)
|
addr1, _ := address.ParseCIDR(testAddr1)
|
||||||
@@ -184,6 +186,9 @@ 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
|
||||||
|
require.NotEqual(t, addrx, preAddr)
|
||||||
router.Flush()
|
router.Flush()
|
||||||
|
|
||||||
// Now try the claim again
|
// Now try the claim again
|
||||||
@@ -201,6 +206,11 @@ func TestAllocatorClaim(t *testing.T) {
|
|||||||
// claiming the address allocated on the other peer should fail
|
// claiming the address allocated on the other peer should fail
|
||||||
err = alloc.SimplyClaim(container1, address.MakeCIDR(subnet, addrx))
|
err = alloc.SimplyClaim(container1, address.MakeCIDR(subnet, addrx))
|
||||||
require.Error(t, err, "claiming address allocated on other peer should fail")
|
require.Error(t, err, "claiming address allocated on other peer should fail")
|
||||||
|
// claiming the pre-claimed address should fail on both peers
|
||||||
|
err = alloc.SimplyClaim(container3, preAddr)
|
||||||
|
require.Error(t, err, "claiming address allocated on other peer should fail")
|
||||||
|
err = allocs[0].SimplyClaim(container3, preAddr)
|
||||||
|
require.Error(t, err, "claiming address allocated on other peer should fail")
|
||||||
// Check an address outside of our universe
|
// Check an address outside of our universe
|
||||||
addr2, _ := address.ParseCIDR(testAddr2)
|
addr2, _ := address.ParseCIDR(testAddr2)
|
||||||
err = alloc.SimplyClaim(container1, addr2)
|
err = alloc.SimplyClaim(container1, addr2)
|
||||||
|
|||||||
+5
-5
@@ -12,10 +12,10 @@ import (
|
|||||||
|
|
||||||
type claim struct {
|
type claim struct {
|
||||||
resultChan chan<- error
|
resultChan chan<- error
|
||||||
ident string
|
ident string // a container ID, something like "weave:expose", or api.NoContainerID
|
||||||
cidr address.CIDR
|
cidr address.CIDR // single address being claimed
|
||||||
isContainer bool
|
isContainer bool // true if ident is a container ID
|
||||||
noErrorOnUnknown bool
|
noErrorOnUnknown bool // if false, error or block if we don't know; if true return ok but keep trying
|
||||||
hasBeenCancelled func() bool
|
hasBeenCancelled func() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ func (c *claim) sendResult(result error) {
|
|||||||
|
|
||||||
// Try returns true for success (or failure), false if we need to try again later
|
// Try returns true for success (or failure), false if we need to try again later
|
||||||
func (c *claim) Try(alloc *Allocator) bool {
|
func (c *claim) Try(alloc *Allocator) bool {
|
||||||
if c.hasBeenCancelled() {
|
if c.hasBeenCancelled != nil && c.hasBeenCancelled() {
|
||||||
c.Cancel()
|
c.Cancel()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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")
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ type mockDB struct{}
|
|||||||
func (d *mockDB) Load(_ string, _ interface{}) (bool, error) { return false, nil }
|
func (d *mockDB) Load(_ string, _ interface{}) (bool, error) { return false, nil }
|
||||||
func (d *mockDB) Save(_ string, _ interface{}) error { return nil }
|
func (d *mockDB) Save(_ string, _ interface{}) error { return nil }
|
||||||
|
|
||||||
func makeAllocator(name string, cidrStr string, quorum uint) (*Allocator, address.CIDR) {
|
func makeAllocator(name string, cidrStr string, quorum uint, preClaims ...PreClaim) (*Allocator, address.CIDR) {
|
||||||
peername, err := mesh.PeerNameFromString(name)
|
peername, err := mesh.PeerNameFromString(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@@ -145,6 +145,7 @@ func makeAllocator(name string, cidrStr string, quorum uint) (*Allocator, addres
|
|||||||
OurNickname: "nick-" + name,
|
OurNickname: "nick-" + name,
|
||||||
Universe: cidr,
|
Universe: cidr,
|
||||||
IsObserver: quorum == 0,
|
IsObserver: quorum == 0,
|
||||||
|
PreClaims: preClaims,
|
||||||
Quorum: func() uint { return quorum },
|
Quorum: func() uint { return quorum },
|
||||||
Db: new(mockDB),
|
Db: new(mockDB),
|
||||||
IsKnownPeer: func(mesh.PeerName) bool { return true },
|
IsKnownPeer: func(mesh.PeerName) bool { return true },
|
||||||
@@ -213,15 +214,19 @@ func AssertNothingSentErr(t *testing.T, ch <-chan error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeNetworkOfAllocators(size int, cidr string) ([]*Allocator, *gossip.TestRouter, address.CIDR) {
|
func makeNetworkOfAllocators(size int, cidr string, preClaims ...[]PreClaim) ([]*Allocator, *gossip.TestRouter, address.CIDR) {
|
||||||
gossipRouter := gossip.NewTestRouter(0.0)
|
gossipRouter := gossip.NewTestRouter(0.0)
|
||||||
allocs := make([]*Allocator, size)
|
allocs := make([]*Allocator, size)
|
||||||
var subnet address.CIDR
|
var subnet address.CIDR
|
||||||
|
|
||||||
for i := 0; i < size; i++ {
|
for i := 0; i < size; i++ {
|
||||||
var alloc *Allocator
|
var alloc *Allocator
|
||||||
|
preClaim := []PreClaim{}
|
||||||
|
if i < len(preClaims) {
|
||||||
|
preClaim = preClaims[i]
|
||||||
|
}
|
||||||
alloc, subnet = makeAllocator(fmt.Sprintf("%02d:00:00:02:00:00", i),
|
alloc, subnet = makeAllocator(fmt.Sprintf("%02d:00:00:02:00:00", i),
|
||||||
cidr, uint(size/2+1))
|
cidr, uint(size/2+1), preClaim...)
|
||||||
alloc.SetInterfaces(gossipRouter.Connect(alloc.ourName, alloc))
|
alloc.SetInterfaces(gossipRouter.Connect(alloc.ourName, alloc))
|
||||||
alloc.Start()
|
alloc.Start()
|
||||||
allocs[i] = alloc
|
allocs[i] = alloc
|
||||||
|
|||||||
+1
-1
@@ -222,7 +222,7 @@ func (h *handler) handleReverse(w dns.ResponseWriter, req *dns.Msg) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ipStr := strings.TrimSuffix(req.Question[0].Name, "."+reverseDNSdomain)
|
ipStr := strings.TrimSuffix(strings.ToLower(req.Question[0].Name), "."+reverseDNSdomain)
|
||||||
ip, err := address.ParseIP(ipStr)
|
ip, err := address.ParseIP(ipStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.nameError(w, req)
|
h.nameError(w, req)
|
||||||
|
|||||||
@@ -6,4 +6,6 @@ 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-"
|
||||||
)
|
)
|
||||||
+68
-1
@@ -2,6 +2,7 @@ package ipset
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
@@ -22,15 +23,18 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() Interface {
|
func New() Interface {
|
||||||
return &ipset{}
|
return &ipset{refCount: newRefCount()}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) Create(ipsetName Name, ipsetType Type) error {
|
func (i *ipset) Create(ipsetName Name, ipsetType Type) error {
|
||||||
@@ -38,32 +42,95 @@ 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 {
|
||||||
|
if i.inc(ipsetName, entry) > 1 { // already in the set
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return doExec("add", string(ipsetName), entry)
|
return doExec("add", string(ipsetName), entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) DelEntry(ipsetName Name, entry string) error {
|
func (i *ipset) DelEntry(ipsetName Name, entry string) error {
|
||||||
|
if i.dec(ipsetName, entry) > 0 { // still needed
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return doExec("del", string(ipsetName), entry)
|
return doExec("del", string(ipsetName), entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) Flush(ipsetName Name) error {
|
func (i *ipset) Flush(ipsetName Name) error {
|
||||||
|
i.removeSet(ipsetName)
|
||||||
return doExec("flush", string(ipsetName))
|
return doExec("flush", string(ipsetName))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) FlushAll() error {
|
func (i *ipset) FlushAll() error {
|
||||||
|
i.refCount = newRefCount()
|
||||||
return doExec("flush")
|
return doExec("flush")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) Destroy(ipsetName Name) error {
|
func (i *ipset) Destroy(ipsetName Name) error {
|
||||||
|
i.removeSet(ipsetName)
|
||||||
return doExec("destroy", string(ipsetName))
|
return doExec("destroy", string(ipsetName))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) DestroyAll() error {
|
func (i *ipset) DestroyAll() error {
|
||||||
|
i.refCount = newRefCount()
|
||||||
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)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reference-counting
|
||||||
|
type key struct {
|
||||||
|
ipsetName Name
|
||||||
|
entry string
|
||||||
|
}
|
||||||
|
|
||||||
|
// note no locking is required as all operations are serialised in the controller
|
||||||
|
type refCount struct {
|
||||||
|
ref map[key]int
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRefCount() refCount {
|
||||||
|
return refCount{ref: make(map[key]int)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rc *refCount) inc(ipsetName Name, entry string) int {
|
||||||
|
k := key{ipsetName, entry}
|
||||||
|
rc.ref[k]++
|
||||||
|
return rc.ref[k]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rc *refCount) dec(ipsetName Name, entry string) int {
|
||||||
|
k := key{ipsetName, entry}
|
||||||
|
rc.ref[k]--
|
||||||
|
return rc.ref[k]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rc *refCount) removeSet(ipsetName Name) {
|
||||||
|
for k := range rc.ref {
|
||||||
|
if k.ipsetName == ipsetName {
|
||||||
|
delete(rc.ref, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+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 {
|
||||||
|
|||||||
+43
-17
@@ -5,11 +5,14 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
"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"
|
||||||
@@ -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); 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 {
|
||||||
@@ -170,9 +189,12 @@ func (c *CNIPlugin) CmdDel(args *skel.CmdArgs) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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)
|
return fmt.Errorf("error removing interface %q: %s", args.IfName, err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Default IPAM is Weave's own
|
// Default IPAM is Weave's own
|
||||||
if conf.IPAM.Type == "" {
|
if conf.IPAM.Type == "" {
|
||||||
@@ -180,6 +202,10 @@ 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)
|
||||||
}
|
}
|
||||||
|
// Hack - don't know how we should detect this situation properly
|
||||||
|
if args.Netns == "" && strings.Contains(err.Error(), "no addresses") {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to release IP address: %s", err)
|
return fmt.Errorf("unable to release IP address: %s", err)
|
||||||
}
|
}
|
||||||
|
|||||||
+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:
|
||||||
|
|||||||
+27
-18
@@ -2,11 +2,29 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
modprobe_safe() {
|
||||||
|
modprobe $1 || echo "Ignore the error if \"$1\" is built-in in the kernel" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check whether xt_set actually exists
|
||||||
|
xt_set_exists() {
|
||||||
|
ipset create weave-kube-test hash:ip
|
||||||
|
iptables -t filter -N WEAVE-KUBE-TEST
|
||||||
|
if ! iptables -A WEAVE-KUBE-TEST -m set --match-set weave-kube-test src -j DROP; then
|
||||||
|
NOT_EXIST=1
|
||||||
|
fi
|
||||||
|
iptables -F WEAVE-KUBE-TEST
|
||||||
|
iptables -X WEAVE-KUBE-TEST
|
||||||
|
ipset destroy weave-kube-test
|
||||||
|
[ -z "$NOT_EXIST" ] || (echo "\"xt_set\" does not exist" >&2 && return 1)
|
||||||
|
}
|
||||||
|
|
||||||
# Default if not supplied - same as weave net default
|
# Default if not supplied - same as weave net default
|
||||||
IPALLOC_RANGE=${IPALLOC_RANGE:-10.32.0.0/12}
|
IPALLOC_RANGE=${IPALLOC_RANGE:-10.32.0.0/12}
|
||||||
HTTP_ADDR=${WEAVE_HTTP_ADDR:-127.0.0.1:6784}
|
HTTP_ADDR=${WEAVE_HTTP_ADDR:-127.0.0.1:6784}
|
||||||
STATUS_ADDR=${WEAVE_STATUS_ADDR:-0.0.0.0:6782}
|
STATUS_ADDR=${WEAVE_STATUS_ADDR:-0.0.0.0:6782}
|
||||||
HOST_ROOT=${HOST_ROOT:-/host}
|
HOST_ROOT=${HOST_ROOT:-/host}
|
||||||
|
CONN_LIMIT=${CONN_LIMIT:-30}
|
||||||
|
|
||||||
# Check if the IP range overlaps anything existing on the host
|
# Check if the IP range overlaps anything existing on the host
|
||||||
/usr/bin/weaveutil netcheck $IPALLOC_RANGE weave
|
/usr/bin/weaveutil netcheck $IPALLOC_RANGE weave
|
||||||
@@ -14,6 +32,13 @@ HOST_ROOT=${HOST_ROOT:-/host}
|
|||||||
# Default for network policy
|
# Default for network policy
|
||||||
EXPECT_NPC=${EXPECT_NPC:-1}
|
EXPECT_NPC=${EXPECT_NPC:-1}
|
||||||
|
|
||||||
|
# Ensure we have the required modules for NPC
|
||||||
|
if [ "${EXPECT_NPC}" != "0" ]; then
|
||||||
|
modprobe_safe br_netfilter
|
||||||
|
modprobe_safe xt_set
|
||||||
|
xt_set_exists
|
||||||
|
fi
|
||||||
|
|
||||||
# kube-proxy requires that bridged traffic passes through netfilter
|
# kube-proxy requires that bridged traffic passes through netfilter
|
||||||
if ! BRIDGE_NF_ENABLED=$(cat /proc/sys/net/bridge/bridge-nf-call-iptables); then
|
if ! BRIDGE_NF_ENABLED=$(cat /proc/sys/net/bridge/bridge-nf-call-iptables); then
|
||||||
echo "Cannot detect bridge-nf support - network policy and iptables mode kubeproxy may not work reliably" >&2
|
echo "Cannot detect bridge-nf support - network policy and iptables mode kubeproxy may not work reliably" >&2
|
||||||
@@ -66,14 +91,6 @@ if [ -z "$IPALLOC_INIT" ]; then
|
|||||||
IPALLOC_INIT="consensus=$(peer_count $KUBE_PEERS)"
|
IPALLOC_INIT="consensus=$(peer_count $KUBE_PEERS)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
reclaim_ips() {
|
|
||||||
ID=$1
|
|
||||||
shift
|
|
||||||
for CIDR in "$@" ; do
|
|
||||||
curl -s -S -X PUT "$HTTP_ADDR/ip/$ID/$CIDR" || true
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
post_start_actions() {
|
post_start_actions() {
|
||||||
# Wait for weave process to become responsive
|
# Wait for weave process to become responsive
|
||||||
while true ; do
|
while true ; do
|
||||||
@@ -81,15 +98,6 @@ post_start_actions() {
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# Tell the newly-started weave about existing weave bridge IPs
|
|
||||||
/usr/bin/weaveutil container-addrs weave weave:expose | while read ID IFACE MAC IPS; do
|
|
||||||
reclaim_ips "weave:expose" $IPS
|
|
||||||
done
|
|
||||||
# Tell weave about existing weave process IPs
|
|
||||||
/usr/bin/weaveutil process-addrs weave | while read ID IFACE MAC IPS; do
|
|
||||||
reclaim_ips "_" $IPS
|
|
||||||
done
|
|
||||||
|
|
||||||
# Install CNI plugin binary to typical CNI bin location
|
# Install CNI plugin binary to typical CNI bin location
|
||||||
# with fall-back to CNI directory used by kube-up on GCI OS
|
# with fall-back to CNI directory used by kube-up on GCI OS
|
||||||
if ! mkdir -p $HOST_ROOT/opt/cni/bin ; then
|
if ! mkdir -p $HOST_ROOT/opt/cni/bin ; then
|
||||||
@@ -109,9 +117,10 @@ 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 \
|
||||||
|
--conn-limit=$CONN_LIMIT \
|
||||||
"$@" \
|
"$@" \
|
||||||
$KUBE_PEERS
|
$KUBE_PEERS
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
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
|
||||||
|
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
|
||||||
@@ -46,6 +46,8 @@ spec:
|
|||||||
mountPath: /host/etc
|
mountPath: /host/etc
|
||||||
- name: dbus
|
- name: dbus
|
||||||
mountPath: /host/var/lib/dbus
|
mountPath: /host/var/lib/dbus
|
||||||
|
- name: lib-modules
|
||||||
|
mountPath: /lib/modules
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 10m
|
cpu: 10m
|
||||||
@@ -73,3 +75,6 @@ spec:
|
|||||||
- name: dbus
|
- name: dbus
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /var/lib/dbus
|
path: /var/lib/dbus
|
||||||
|
- name: lib-modules
|
||||||
|
hostPath:
|
||||||
|
path: /lib/modules
|
||||||
+38
-6
@@ -80,15 +80,23 @@ func resetIPTables(ipt *iptables.IPTables) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func resetIPSets(ips ipset.Interface) error {
|
func resetIPSets(ips ipset.Interface) error {
|
||||||
// TODO should restrict ipset operations to the `weave-` prefix:
|
// Remove ipsets prefixed `weave-` only
|
||||||
|
|
||||||
if err := ips.FlushAll(); err != nil {
|
sets, err := ips.List(npc.IpsetNamePrefix)
|
||||||
|
if err != nil {
|
||||||
|
common.Log.Errorf("Failed to retrieve list of ipsets")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ips.DestroyAll(); err != nil {
|
common.Log.Debugf("Got list of ipsets: %v", sets)
|
||||||
|
|
||||||
|
for _, s := range sets {
|
||||||
|
common.Log.Debugf("Destroying ipsets '%s'", string(s))
|
||||||
|
if err := ips.Destroy(s); err != nil {
|
||||||
|
common.Log.Errorf("Failed to destroy ipset '%s'", string(s))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -127,7 +135,15 @@ func root(cmd *cobra.Command, args []string) {
|
|||||||
handleError(npc.AddNamespace(obj.(*coreapi.Namespace)))
|
handleError(npc.AddNamespace(obj.(*coreapi.Namespace)))
|
||||||
},
|
},
|
||||||
DeleteFunc: func(obj interface{}) {
|
DeleteFunc: func(obj interface{}) {
|
||||||
handleError(npc.DeleteNamespace(obj.(*coreapi.Namespace)))
|
switch obj := obj.(type) {
|
||||||
|
case *coreapi.Namespace:
|
||||||
|
handleError(npc.DeleteNamespace(obj))
|
||||||
|
case cache.DeletedFinalStateUnknown:
|
||||||
|
// We know this object has gone away, but its final state is no longer
|
||||||
|
// available from the API server. Instead we use the last copy of it
|
||||||
|
// that we have, which is good enough for our cleanup.
|
||||||
|
handleError(npc.DeleteNamespace(obj.Obj.(*coreapi.Namespace)))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
UpdateFunc: func(old, new interface{}) {
|
UpdateFunc: func(old, new interface{}) {
|
||||||
handleError(npc.UpdateNamespace(old.(*coreapi.Namespace), new.(*coreapi.Namespace)))
|
handleError(npc.UpdateNamespace(old.(*coreapi.Namespace), new.(*coreapi.Namespace)))
|
||||||
@@ -139,7 +155,15 @@ func root(cmd *cobra.Command, args []string) {
|
|||||||
handleError(npc.AddPod(obj.(*coreapi.Pod)))
|
handleError(npc.AddPod(obj.(*coreapi.Pod)))
|
||||||
},
|
},
|
||||||
DeleteFunc: func(obj interface{}) {
|
DeleteFunc: func(obj interface{}) {
|
||||||
handleError(npc.DeletePod(obj.(*coreapi.Pod)))
|
switch obj := obj.(type) {
|
||||||
|
case *coreapi.Pod:
|
||||||
|
handleError(npc.DeletePod(obj))
|
||||||
|
case cache.DeletedFinalStateUnknown:
|
||||||
|
// We know this object has gone away, but its final state is no longer
|
||||||
|
// available from the API server. Instead we use the last copy of it
|
||||||
|
// that we have, which is good enough for our cleanup.
|
||||||
|
handleError(npc.DeletePod(obj.Obj.(*coreapi.Pod)))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
UpdateFunc: func(old, new interface{}) {
|
UpdateFunc: func(old, new interface{}) {
|
||||||
handleError(npc.UpdatePod(old.(*coreapi.Pod), new.(*coreapi.Pod)))
|
handleError(npc.UpdatePod(old.(*coreapi.Pod), new.(*coreapi.Pod)))
|
||||||
@@ -151,7 +175,15 @@ func root(cmd *cobra.Command, args []string) {
|
|||||||
handleError(npc.AddNetworkPolicy(obj.(*extnapi.NetworkPolicy)))
|
handleError(npc.AddNetworkPolicy(obj.(*extnapi.NetworkPolicy)))
|
||||||
},
|
},
|
||||||
DeleteFunc: func(obj interface{}) {
|
DeleteFunc: func(obj interface{}) {
|
||||||
handleError(npc.DeleteNetworkPolicy(obj.(*extnapi.NetworkPolicy)))
|
switch obj := obj.(type) {
|
||||||
|
case *extnapi.NetworkPolicy:
|
||||||
|
handleError(npc.DeleteNetworkPolicy(obj))
|
||||||
|
case cache.DeletedFinalStateUnknown:
|
||||||
|
// We know this object has gone away, but its final state is no longer
|
||||||
|
// available from the API server. Instead we use the last copy of it
|
||||||
|
// that we have, which is good enough for our cleanup.
|
||||||
|
handleError(npc.DeleteNetworkPolicy(obj.Obj.(*extnapi.NetworkPolicy)))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
UpdateFunc: func(old, new interface{}) {
|
UpdateFunc: func(old, new interface{}) {
|
||||||
handleError(npc.UpdateNetworkPolicy(old.(*extnapi.NetworkPolicy), new.(*extnapi.NetworkPolicy)))
|
handleError(npc.UpdateNetworkPolicy(old.(*extnapi.NetworkPolicy), new.(*extnapi.NetworkPolicy)))
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ RUN apk add --update \
|
|||||||
curl \
|
curl \
|
||||||
ethtool \
|
ethtool \
|
||||||
iptables \
|
iptables \
|
||||||
|
ipset \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
util-linux \
|
util-linux \
|
||||||
conntrack-tools \
|
conntrack-tools \
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
+20
-14
@@ -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 {
|
||||||
@@ -306,13 +304,16 @@ func main() {
|
|||||||
}
|
}
|
||||||
trackerName = "awsvpc"
|
trackerName = "awsvpc"
|
||||||
}
|
}
|
||||||
allocator, defaultSubnet = createAllocator(router, ipamConfig, db, t, isKnownPeer)
|
var allContainerIDs []string
|
||||||
observeContainers(allocator)
|
|
||||||
if dockerCli != nil {
|
if dockerCli != nil {
|
||||||
ids, err := dockerCli.AllContainerIDs()
|
allContainerIDs, err = dockerCli.AllContainerIDs()
|
||||||
checkFatal(err)
|
checkFatal(err)
|
||||||
allocator.PruneOwned(ids)
|
|
||||||
}
|
}
|
||||||
|
preClaims, err := findExistingAddresses(dockerCli, allContainerIDs, weavenet.WeaveBridgeName)
|
||||||
|
checkFatal(err)
|
||||||
|
allocator, defaultSubnet = createAllocator(router, ipamConfig, preClaims, db, t, isKnownPeer)
|
||||||
|
observeContainers(allocator)
|
||||||
|
allocator.PruneOwned(allContainerIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -445,7 +446,7 @@ func createOverlay(datapathName string, ifaceName string, isAWSVPC bool, host st
|
|||||||
return overlay, bridge
|
return overlay, bridge
|
||||||
}
|
}
|
||||||
|
|
||||||
func createAllocator(router *weave.NetworkRouter, config ipamConfig, db db.DB, track tracker.LocalRangeTracker, isKnownPeer func(mesh.PeerName) bool) (*ipam.Allocator, address.CIDR) {
|
func createAllocator(router *weave.NetworkRouter, config ipamConfig, preClaims []ipam.PreClaim, db db.DB, track tracker.LocalRangeTracker, isKnownPeer func(mesh.PeerName) bool) (*ipam.Allocator, address.CIDR) {
|
||||||
ipRange, err := ipam.ParseCIDRSubnet(config.IPRangeCIDR)
|
ipRange, err := ipam.ParseCIDRSubnet(config.IPRangeCIDR)
|
||||||
checkFatal(err)
|
checkFatal(err)
|
||||||
defaultSubnet := ipRange
|
defaultSubnet := ipRange
|
||||||
@@ -464,6 +465,7 @@ func createAllocator(router *weave.NetworkRouter, config ipamConfig, db db.DB, t
|
|||||||
Seed: config.SeedPeerNames,
|
Seed: config.SeedPeerNames,
|
||||||
Universe: ipRange,
|
Universe: ipRange,
|
||||||
IsObserver: config.Observer,
|
IsObserver: config.Observer,
|
||||||
|
PreClaims: preClaims,
|
||||||
Quorum: func() uint { return determineQuorum(config.PeerCount, router) },
|
Quorum: func() uint { return determineQuorum(config.PeerCount, router) },
|
||||||
Db: db,
|
Db: db,
|
||||||
IsKnownPeer: isKnownPeer,
|
IsKnownPeer: isKnownPeer,
|
||||||
@@ -472,7 +474,9 @@ func createAllocator(router *weave.NetworkRouter, config ipamConfig, db db.DB, t
|
|||||||
|
|
||||||
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) })
|
||||||
|
|
||||||
@@ -482,7 +486,9 @@ func createAllocator(router *weave.NetworkRouter, config ipamConfig, db db.DB, t
|
|||||||
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)
|
||||||
|
|||||||
@@ -82,6 +82,18 @@ var metrics = []metric{
|
|||||||
ch <- intGauge(desc, metrics.Flows)
|
ch <- intGauge(desc, metrics.Flows)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
{desc("weave_ipam_pending_allocates", "Number of pending allocates."),
|
||||||
|
func(s WeaveStatus, desc *prometheus.Desc, ch chan<- prometheus.Metric) {
|
||||||
|
if s.IPAM != nil {
|
||||||
|
ch <- intGauge(desc, len(s.IPAM.PendingAllocates))
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{desc("weave_ipam_pending_claims", "Number of pending claims."),
|
||||||
|
func(s WeaveStatus, desc *prometheus.Desc, ch chan<- prometheus.Metric) {
|
||||||
|
if s.IPAM != nil {
|
||||||
|
ch <- intGauge(desc, len(s.IPAM.PendingClaims))
|
||||||
|
}
|
||||||
|
}},
|
||||||
}
|
}
|
||||||
|
|
||||||
func fastDPMetrics(s WeaveStatus) *weave.FastDPMetrics {
|
func fastDPMetrics(s WeaveStatus) *weave.FastDPMetrics {
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
|
||||||
|
docker "github.com/fsouza/go-dockerclient"
|
||||||
|
|
||||||
|
"github.com/weaveworks/weave/api"
|
||||||
|
"github.com/weaveworks/weave/common"
|
||||||
|
weavedocker "github.com/weaveworks/weave/common/docker"
|
||||||
|
"github.com/weaveworks/weave/ipam"
|
||||||
|
weavenet "github.com/weaveworks/weave/net"
|
||||||
|
"github.com/weaveworks/weave/net/address"
|
||||||
|
)
|
||||||
|
|
||||||
|
func a(cidr *net.IPNet) address.CIDR {
|
||||||
|
prefixLength, _ := cidr.Mask.Size()
|
||||||
|
return address.CIDR{Addr: address.FromIP4(cidr.IP), PrefixLen: prefixLength}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all the existing Weave IPs at startup, so we can stop IPAM
|
||||||
|
// giving out any as duplicates
|
||||||
|
func findExistingAddresses(dockerCli *weavedocker.Client, containerIDs []string, bridgeName string) (addrs []ipam.PreClaim, err error) {
|
||||||
|
Log.Infof("Checking for pre-existing addresses on %s bridge", bridgeName)
|
||||||
|
// First get the address for the bridge
|
||||||
|
bridgeNetDev, err := weavenet.GetBridgeNetDev(bridgeName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, cidr := range bridgeNetDev.CIDRs {
|
||||||
|
Log.Infof("%s bridge has address %v", bridgeName, cidr)
|
||||||
|
addrs = append(addrs, ipam.PreClaim{Ident: "weave:expose", Cidr: a(cidr)})
|
||||||
|
}
|
||||||
|
|
||||||
|
add := func(cid string, isContainer bool, netDevs []weavenet.Dev) {
|
||||||
|
for _, netDev := range netDevs {
|
||||||
|
for _, cidr := range netDev.CIDRs {
|
||||||
|
Log.Infof("Found address %v for ID %s", cidr, cid)
|
||||||
|
addrs = append(addrs, ipam.PreClaim{Ident: cid, IsContainer: isContainer, Cidr: a(cidr)})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then find all veths connected to the bridge
|
||||||
|
peerIDs, err := weavenet.ConnectedToBridgeVethPeerIds(bridgeName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now iterate over all containers to see if they have a network
|
||||||
|
// namespace with an attached interface
|
||||||
|
if dockerCli != nil {
|
||||||
|
for _, cid := range containerIDs {
|
||||||
|
container, err := dockerCli.InspectContainer(cid)
|
||||||
|
if err != nil {
|
||||||
|
if _, ok := err.(*docker.NoSuchContainer); ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if container.State.Pid != 0 {
|
||||||
|
netDevs, err := weavenet.GetNetDevsByVethPeerIds(container.State.Pid, peerIDs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
add(cid, true, netDevs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If we don't have a Docker connection, iterate over all processes
|
||||||
|
pids, err := common.AllPids("/proc")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, pid := range pids {
|
||||||
|
netDevs, err := weavenet.GetNetDevsByVethPeerIds(pid, peerIDs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
add(api.NoContainerID, false, netDevs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return addrs, nil
|
||||||
|
}
|
||||||
@@ -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).
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+28
-14
@@ -1,10 +1,11 @@
|
|||||||
---
|
---
|
||||||
title: FAQ
|
title: FAQ
|
||||||
menu_order: 100
|
menu_order: 200
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
<a name="container-ip"></a>
|
||||||
**Q: How do I obtain the IP of a specific container when I'm using Weave?**
|
**Q: How do I obtain the IP of a specific container when I'm using Weave?**
|
||||||
|
|
||||||
You can use `weave ps <container>` to see the allocated address of a container on a Weave network.
|
You can use `weave ps <container>` to see the allocated address of a container on a Weave network.
|
||||||
@@ -12,6 +13,7 @@ You can use `weave ps <container>` to see the allocated address of a container o
|
|||||||
See [Troubleshooting Weave - List attached containers](/site/troubleshooting.md#list-attached-containers).
|
See [Troubleshooting Weave - List attached containers](/site/troubleshooting.md#list-attached-containers).
|
||||||
|
|
||||||
|
|
||||||
|
<a name="specific-ip"></a>
|
||||||
**Q: My dockerized app needs to check the request of an application that uses a static IP. Is it possible to manually change the IP of a container?**
|
**Q: My dockerized app needs to check the request of an application that uses a static IP. Is it possible to manually change the IP of a container?**
|
||||||
|
|
||||||
|
|
||||||
@@ -20,11 +22,13 @@ You can manually change the IP of a container using [Classless Inter-Domain Rout
|
|||||||
For more information, refer to [Manually Specifying the IP Address of a Container](/site/using-weave/manual-ip-address.md).
|
For more information, refer to [Manually Specifying the IP Address of a Container](/site/using-weave/manual-ip-address.md).
|
||||||
|
|
||||||
|
|
||||||
|
<a name="expose-container"></a>
|
||||||
**Q: How do I expose one of my containers to the outside world?**
|
**Q: How do I expose one of my containers to the outside world?**
|
||||||
|
|
||||||
Exposing a container to the outside world is described in [Exporting Services](/site/using-weave/service-management.md#exporting).
|
Exposing a container to the outside world is described in [Exporting Services](/site/using-weave/service-management.md#exporting).
|
||||||
|
|
||||||
|
|
||||||
|
<a name="legacy-network"></a>
|
||||||
**Q: Can I connect my existing 'legacy' network with a Weave container network?**
|
**Q: Can I connect my existing 'legacy' network with a Weave container network?**
|
||||||
|
|
||||||
Yes you can.
|
Yes you can.
|
||||||
@@ -36,19 +40,15 @@ A simple way to accomplish this would be to run Weave on the host and then run,
|
|||||||
Yet another option is to expose a port from the container on host B and then connect to it. You can read about exposing ports in [Exporting Services](/site/using-weave/service-management.md#exporting).
|
Yet another option is to expose a port from the container on host B and then connect to it. You can read about exposing ports in [Exporting Services](/site/using-weave/service-management.md#exporting).
|
||||||
|
|
||||||
|
|
||||||
|
<a name="duplicate-ip"></a>
|
||||||
**Q: Why am I seeing the same IP address assigned to two different containers on different hosts?**
|
**Q: Why am I seeing the same IP address assigned to two different containers on different hosts?**
|
||||||
|
|
||||||
Under normal circumstances, this should never happen, but it can occur if `weave forget` and `weave rmpeer` was run on more than one host.
|
Under normal circumstances, this should never happen, but it can occur if `weave rmpeer` was run on more than one host.
|
||||||
|
|
||||||
You cannot call `weave rmpeer` on more than one host. The address space, which was owned by the stale peer cannot be left dangling, and as a result it gets reassigned. In this instance, the address is reassigned to the peer on which `weave rmpeer` was run. Therefore, if you run `weave forget` and then `weave rmpeer` on more than one host at a time, it results in duplicate IPs on more than one host.
|
For more information see [Starting, Stopping and Removing Peers](/site/ipam/stop-remove-peers-ipam.md).
|
||||||
|
|
||||||
Once the peers detect the inconsistency, they log the error and drop the connection that supplied the inconsistent data. The rest of the peers will carry on with their view of the world, but the network will not function correctly.
|
|
||||||
|
|
||||||
Some peers may be able to communicate their claim to the others before they run `rmpeer` (i.e. it's a race), so what you can expect is a few cliques of peers that are still talking to each other, but repeatedly dropping attempted connections with peers in other cliques.
|
|
||||||
|
|
||||||
For more information on see [Allocating IP Addresses](/site/ipam.md) and also, [Starting, Stopping and Removing Peers](/site/ipam/stop-remove-peers-ipam.md).
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="dead-node"></a>
|
||||||
**Q: What is the best practice for resetting a node that goes out of service?**
|
**Q: What is the best practice for resetting a node that goes out of service?**
|
||||||
|
|
||||||
When a node goes out of service, the best option is to call `weave rmpeer` on one host and then `weave forget` on all the other hosts.
|
When a node goes out of service, the best option is to call `weave rmpeer` on one host and then `weave forget` on all the other hosts.
|
||||||
@@ -56,6 +56,7 @@ When a node goes out of service, the best option is to call `weave rmpeer` on on
|
|||||||
See [Starting, Stopping and Removing Peers](/site/ipam/stop-remove-peers-ipam.md) for an in-depth discussion.
|
See [Starting, Stopping and Removing Peers](/site/ipam/stop-remove-peers-ipam.md) for an in-depth discussion.
|
||||||
|
|
||||||
|
|
||||||
|
<a name="performance"></a>
|
||||||
**Q: What about Weave's performance? Are software defined network overlays just as fast as native networking?**
|
**Q: What about Weave's performance? Are software defined network overlays just as fast as native networking?**
|
||||||
|
|
||||||
All virtualization techniques have some overhead, and Weave's overhead is typically around 2-3%. Unless your system is completely bottlenecked on the network, you won't notice this during normal operation.
|
All virtualization techniques have some overhead, and Weave's overhead is typically around 2-3%. Unless your system is completely bottlenecked on the network, you won't notice this during normal operation.
|
||||||
@@ -65,6 +66,7 @@ Weave Net also automatically uses the fastest datapath between two hosts. When W
|
|||||||
For more information about fast datapath see [How Fast Datapath Works](/site/how-it-works/fastdp-how-it-works.md).
|
For more information about fast datapath see [How Fast Datapath Works](/site/how-it-works/fastdp-how-it-works.md).
|
||||||
|
|
||||||
|
|
||||||
|
<a name="query-fastdp"></a>
|
||||||
**Q: How can I tell if Weave is using fast datapath (fastdp) or not?**
|
**Q: How can I tell if Weave is using fast datapath (fastdp) or not?**
|
||||||
|
|
||||||
To view whether Weave is using fastdp or not, you can run, `weave status connections`
|
To view whether Weave is using fastdp or not, you can run, `weave status connections`
|
||||||
@@ -72,24 +74,36 @@ To view whether Weave is using fastdp or not, you can run, `weave status connect
|
|||||||
For more information on this command, see [Using Fast Datapath](/site/using-weave/fastdp.md).
|
For more information on this command, see [Using Fast Datapath](/site/using-weave/fastdp.md).
|
||||||
|
|
||||||
|
|
||||||
|
<a name="encrypted-fastdp"></a>
|
||||||
**Q: Does encryption work with fastdp?**
|
**Q: Does encryption work with fastdp?**
|
||||||
|
|
||||||
Encryption does not work with fast datapath. If you enable encryption using the `--password` option to launch Weave (or you use the `WEAVE_PASSWORD` environment variable), fast datapath will by default be disabled.
|
Yes, 1.9 version of Weave Net added the encryption feature to fastdp.
|
||||||
|
|
||||||
You can however have a mixture of fast datapath connections over trusted links, as well as, encrypted connections over untrusted links.
|
|
||||||
|
|
||||||
See [Using Fast Datapath](/site/using-weave/fastdp.md) for more information.
|
See [Using Fast Datapath](/site/using-weave/fastdp.md) for more information.
|
||||||
|
|
||||||
|
<a name="app-isolation"></a>
|
||||||
**Q: Can I create multiple networks where containers can communicate on one network, but are isolated from containers on other networks?**
|
**Q: Can I create multiple networks where containers can communicate on one network, but are isolated from containers on other networks?**
|
||||||
|
|
||||||
Yes, of course! Weave allows you to run isolated networks and still allow open communications between individual containers from those isolated networks. You can find information on how to do this in [Application Isolation](/site/using-weave/application-isolation.md).
|
Yes, of course! Weave allows you to run isolated networks and still allow open communications between individual containers from those isolated networks. You can find information on how to do this in [Application Isolation](/site/using-weave/application-isolation.md).
|
||||||
|
|
||||||
|
|
||||||
**Q: Which ports does Weave Net use (e.g. if I am configuring a firewall) ?**
|
**<a name=ports></a>Q: Which ports does Weave Net use (e.g. if I am configuring a firewall) ?**
|
||||||
|
|
||||||
You must permit traffic to flow through TCP 6783 and UDP 6783/6784,
|
You must permit traffic to flow through TCP 6783 and UDP 6783/6784,
|
||||||
which are Weave’s control and data ports.
|
which are Weave’s control and data ports.
|
||||||
|
|
||||||
|
The daemon also uses TCP port 6782 for [metrics](/site/metrics.md), but
|
||||||
|
you would only need to open up this port if you wish to collect metrics
|
||||||
|
from another host.
|
||||||
|
|
||||||
|
The Weave Net daemon listens on localhost (127.0.0.1) TCP port 6784
|
||||||
|
for commands from other Weave Net components. This port should not be
|
||||||
|
opened to other hosts.
|
||||||
|
|
||||||
|
When using encrypted fast datapath, make sure that underlying
|
||||||
|
network does not block ESP traffic (IP protocol 50). For instance
|
||||||
|
on Google Cloud Platform a firewall rule for allowing ESP traffic has
|
||||||
|
to be installed.
|
||||||
|
|
||||||
**<a name=own-image></a>Q: Why do you use your own Docker image `weaveworks/ubuntu`?**
|
**<a name=own-image></a>Q: Why do you use your own Docker image `weaveworks/ubuntu`?**
|
||||||
|
|
||||||
|
|||||||
+3
-5
@@ -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)
|
||||||
@@ -52,10 +53,6 @@ Weave Net automatically chooses the fastest available method to
|
|||||||
transport data between peers. The best performing of these
|
transport data between peers. The best performing of these
|
||||||
(the 'fast datapath') offers near-native throughput and latency.
|
(the 'fast datapath') offers near-native throughput and latency.
|
||||||
|
|
||||||
Fast datapath does not support encryption. For full details on configuring
|
|
||||||
Weave when you have connections that traverse untrusted networks,
|
|
||||||
see [Securing Connections Across Untrusted Networks](/site/using-weave/security-untrusted-networks.md) for more details.
|
|
||||||
|
|
||||||
See [Using Fast Datapath](/site/using-weave/fastdp.md) and
|
See [Using Fast Datapath](/site/using-weave/fastdp.md) and
|
||||||
[How Fast Datapath Works](/site/how-it-works/fastdp-how-it-works.md).
|
[How Fast Datapath Works](/site/how-it-works/fastdp-how-it-works.md).
|
||||||
|
|
||||||
@@ -177,7 +174,8 @@ mechanism which you can use in conjunction with or as an
|
|||||||
alternative to any other security technologies you have
|
alternative to any other security technologies you have
|
||||||
running alongside Weave.
|
running alongside Weave.
|
||||||
|
|
||||||
Weave Net implements encryption and security using the Go version of [Daniel J. Bernstein's NaCl library](http://nacl.cr.yp.to/index.html).
|
Weave Net implements encryption and security using the Go version of [Daniel J. Bernstein's NaCl library](http://nacl.cr.yp.to/index.html),
|
||||||
|
and, additionally in the case of encrypted fast datapath using [the cryptography framework of the Linux kernel](https://en.wikipedia.org/wiki/Crypto_API_(Linux)).
|
||||||
|
|
||||||
For information on how to secure your Docker network connections, see [Securing Connections Across Untrusted Networks](/site/using-weave/security-untrusted-networks.md) and for a more technical discussion on how Weave implements encryption see, [Weave Encryption](/site/how-it-works/encryption.md) and [How Weave Implements Encryption](/site/how-it-works/encryption-implementation.md).
|
For information on how to secure your Docker network connections, see [Securing Connections Across Untrusted Networks](/site/using-weave/security-untrusted-networks.md) and for a more technical discussion on how Weave implements encryption see, [Weave Encryption](/site/how-it-works/encryption.md) and [How Weave Implements Encryption](/site/how-it-works/encryption-implementation.md).
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -107,6 +108,8 @@ attacks.
|
|||||||
|
|
||||||
#### <a name="udp"></a>Encrypting and Decrypting UDP Packets
|
#### <a name="udp"></a>Encrypting and Decrypting UDP Packets
|
||||||
|
|
||||||
|
##### Sleeve
|
||||||
|
|
||||||
UDP connections carry captured traffic between peers. For a UDP packet
|
UDP connections carry captured traffic between peers. For a UDP packet
|
||||||
sent between peers that are using crypto, the encapsulation looks as
|
sent between peers that are using crypto, the encapsulation looks as
|
||||||
follows:
|
follows:
|
||||||
@@ -179,7 +182,33 @@ contained in the set. The window spans at least 2^20 message sequence
|
|||||||
numbers, and hence any re-ordering between the most recent ~1 million
|
numbers, and hence any re-ordering between the most recent ~1 million
|
||||||
messages is handled without dropping messages.
|
messages is handled without dropping messages.
|
||||||
|
|
||||||
|
##### Fast Datapath
|
||||||
|
|
||||||
|
Encryption in fastdp uses [the ESP protocol of IPsec](https://tools.ietf.org/html/rfc2406)
|
||||||
|
in the transport mode. Each VXLAN packet is encrypted with
|
||||||
|
[AES in GCM mode](https://tools.ietf.org/html/rfc4106aesgcm), with 32 byte key and
|
||||||
|
4 byte salt. This combo provides the following security properties:
|
||||||
|
|
||||||
|
* Data confidentiality.
|
||||||
|
* Data origin authentication.
|
||||||
|
* Integrity.
|
||||||
|
* Anti-replay.
|
||||||
|
* Limited traffic flow confidentiality as VXLAN packets are fully encrypted.
|
||||||
|
|
||||||
|
For each connection direction, a different AES-GCM key and salt is used.
|
||||||
|
The pairs are derived with [HKDF](https://tools.ietf.org/html/rfc5869)
|
||||||
|
to which we pass a randomly generated 32 byte salt transferred over the encrypted
|
||||||
|
control plane channel between peers.
|
||||||
|
|
||||||
|
To prevent from replay attacks, which are possible because of the size of
|
||||||
|
sequence number field in ESP (4 bytes), we use extended sequence numbers
|
||||||
|
implemented by [ESN](https://tools.ietf.org/html/rfc4304).
|
||||||
|
|
||||||
|
Authentication of ESP packet integrity and origin is ensured by 16 byte
|
||||||
|
Integrity Check Value of AES-GCM.
|
||||||
|
|
||||||
**See Also**
|
**See Also**
|
||||||
|
|
||||||
* [architecture documentation](https://github.com/weaveworks/weave/blob/master/docs/architecture.txt)
|
* [architecture documentation](https://github.com/weaveworks/weave/blob/master/docs/architecture.txt)
|
||||||
|
* [fastdp encryption](https://github.com/weaveworks/weave/blob/master/docs/fastdp-crypto.md)
|
||||||
* [Securing Containers Across Untrusted Networks](/site/using-weave/security-untrusted-networks.md)
|
* [Securing Containers Across Untrusted Networks](/site/using-weave/security-untrusted-networks.md)
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Encryption and Weave Net
|
title: Encryption and Weave Net
|
||||||
menu_order: 60
|
menu_order: 60
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
@@ -9,7 +10,8 @@ Weave Net peers
|
|||||||
communication
|
communication
|
||||||
[can be encrypted](/site/using-weave/security-untrusted-networks.md).
|
[can be encrypted](/site/using-weave/security-untrusted-networks.md).
|
||||||
|
|
||||||
Encryption is accomplished using the [NaCl](http://nacl.cr.yp.to/)
|
Encryption of control plane traffic (TCP) and data plane traffic (UDP) of sleeve
|
||||||
|
overlay is accomplished using the [NaCl](http://nacl.cr.yp.to/)
|
||||||
crypto libraries, employing Curve25519, XSalsa20 and Poly1305 to
|
crypto libraries, employing Curve25519, XSalsa20 and Poly1305 to
|
||||||
encrypt and authenticate messages. Weave Net protects against
|
encrypt and authenticate messages. Weave Net protects against
|
||||||
injection and replay attacks for traffic forwarded between peers.
|
injection and replay attacks for traffic forwarded between peers.
|
||||||
@@ -32,6 +34,11 @@ extensions to TLS such as [DTLS](https://tools.ietf.org/html/rfc4347)
|
|||||||
which can operate over UDP, these are not widely implemented and
|
which can operate over UDP, these are not widely implemented and
|
||||||
deployed.
|
deployed.
|
||||||
|
|
||||||
|
In the case of fast datapath, data plane traffic is encrypted by using
|
||||||
|
[ESP of IPsec](https://tools.ietf.org/html/rfc2406).
|
||||||
|
The process of encryption is handled by the Linux kernel and is controlled via
|
||||||
|
the IP transformation framework (XFRM).
|
||||||
|
|
||||||
**See Also**
|
**See Also**
|
||||||
|
|
||||||
* [How Weave Implements Encryption](/site/how-it-works/encryption-implementation.md)
|
* [How Weave Implements Encryption](/site/how-it-works/encryption-implementation.md)
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|
||||||
@@ -58,6 +59,9 @@ A [special no-overlay mode for EC2](/site/using-weave/awsvpc.md) can
|
|||||||
optionally be enabled, which allows containers to communicate at the
|
optionally be enabled, which allows containers to communicate at the
|
||||||
full speed of the underlying network.
|
full speed of the underlying network.
|
||||||
|
|
||||||
|
To make encryption in fast datapath work on Google Cloud Platform, see
|
||||||
|
[here](/site/faq.md#ports).
|
||||||
|
|
||||||
**See Also**
|
**See Also**
|
||||||
|
|
||||||
* [Using Weave Net](/site/using-weave.md)
|
* [Using Weave Net](/site/using-weave.md)
|
||||||
|
|||||||
@@ -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
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ See [How Fast Datapath Works](/site/using-weave/fastdp.md) for more information.
|
|||||||
|
|
||||||
Weave uses industry-standard VXLAN encapsulation between hosts. This means you can continue using your favorite packet analyzing tools, such as ‘Wireshark’ to inspect and troubleshoot protocols.
|
Weave uses industry-standard VXLAN encapsulation between hosts. This means you can continue using your favorite packet analyzing tools, such as ‘Wireshark’ to inspect and troubleshoot protocols.
|
||||||
|
|
||||||
###Weave Net is Secure With Built-in Encryption
|
### Weave Net is Secure
|
||||||
|
|
||||||
Weave Net traverses firewalls without requiring a TCP add-on. You can encrypt your traffic, which allows you to connect to apps on hosts even across an untrusted network.
|
Weave Net traverses firewalls without requiring a TCP add-on. You can encrypt your traffic, which allows you to connect to apps on hosts even across an untrusted network.
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
@@ -32,8 +33,26 @@ caught fire, you can go to one of the other hosts and run:
|
|||||||
Weave Net takes all the IP address ranges owned by host3 and transfers
|
Weave Net takes all the IP address ranges owned by host3 and transfers
|
||||||
them to be owned by host1. The name "host3" is resolved via the
|
them to be owned by host1. The name "host3" is resolved via the
|
||||||
'nickname' feature of Weave Net, which defaults to the local host
|
'nickname' feature of Weave Net, which defaults to the local host
|
||||||
name. Alternatively, you can supply a peer name as shown in `weave
|
name. Alternatively, you can supply a peer name as shown in `weave status`.
|
||||||
status`.
|
|
||||||
|
### <a name="caution-rmpeer"></a>Caution###
|
||||||
|
|
||||||
|
You cannot call `weave rmpeer` on more than one host. The address
|
||||||
|
space, which was owned by the stale peer cannot be left dangling, and
|
||||||
|
as a result it gets reassigned. In this instance, the address is
|
||||||
|
reassigned to the peer on which `weave rmpeer` was run. Therefore, if
|
||||||
|
you run `weave forget` and then `weave rmpeer` on more than one host
|
||||||
|
at a time, it results in duplicate IPs on more than one host.
|
||||||
|
|
||||||
|
Once the peers detect the inconsistency, they log the error and drop
|
||||||
|
the connection that supplied the inconsistent data. The rest of the
|
||||||
|
peers will carry on with their view of the world, but the network will
|
||||||
|
not function correctly.
|
||||||
|
|
||||||
|
Some peers may be able to communicate their claim to the others before
|
||||||
|
they run `rmpeer` (i.e. it's a race), so what you can expect is a few
|
||||||
|
cliques of peers that are still talking to each other, but repeatedly
|
||||||
|
dropping attempted connections with peers in other cliques.
|
||||||
|
|
||||||
**See Also**
|
**See Also**
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Troubleshooting the IP Allocator
|
title: Troubleshooting the IP Allocator
|
||||||
menu_order: 30
|
menu_order: 30
|
||||||
|
search_type: Documentation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+37
-13
@@ -1,12 +1,13 @@
|
|||||||
---
|
---
|
||||||
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)
|
||||||
* [Network Policy Controller](#npc)
|
* [Network Policy Controller](#npc)
|
||||||
* [Troubleshooting Blocked Connections](#blocked-connections)
|
* [Troubleshooting Blocked Connections](#blocked-connections)
|
||||||
@@ -18,8 +19,16 @@ 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
|
||||||
@@ -51,11 +60,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,
|
||||||
@@ -138,20 +162,20 @@ 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 1410 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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -19,6 +20,8 @@ exposed:
|
|||||||
* `weave_max_ips` - Size of IP address space used by allocator.
|
* `weave_max_ips` - Size of IP address space used by allocator.
|
||||||
* `weave_dns_entries` - Number of DNS entries.
|
* `weave_dns_entries` - Number of DNS entries.
|
||||||
* `weave_flows` - Number of FastDP flows.
|
* `weave_flows` - Number of FastDP flows.
|
||||||
|
* `weave_ipam_pending_allocates` - Number of pending allocates.
|
||||||
|
* `weave_ipam_pending_claims` - Number of pending claims.
|
||||||
|
|
||||||
#### Publish Router Metrics Endpoint
|
#### Publish Router Metrics Endpoint
|
||||||
|
|
||||||
|
|||||||
@@ -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,13 +1,14 @@
|
|||||||
---
|
---
|
||||||
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:
|
||||||
|
|
||||||
* [Configuring Weave Net to Start Automatically on Boot](#start-on-boot)
|
* [Configuring Weave Net to Start Automatically on Boot](#start-on-boot)
|
||||||
* [Detecting and Reclaiming Lost IP Address Space](#detect-reclaim-ipam)
|
* [Detecting and Reclaiming Lost IP Address Space](#detect-reclaim-ipam)
|
||||||
*[Manually Reclaiming Lost Address Space](#reclaim-address-space)
|
* [Manually Reclaiming Lost Address Space](#manually-reclaim-address-space)
|
||||||
* [Upgrading a Cluster](#cluster-upgrade)
|
* [Upgrading a Cluster](#cluster-upgrade)
|
||||||
* [Resetting Persisted Data](#reset)
|
* [Resetting Persisted Data](#reset)
|
||||||
|
|
||||||
|
|||||||
@@ -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,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
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)
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -32,7 +33,7 @@ Next, launch the two netcat containers onto the default subnet:
|
|||||||
And then to test the isolation, launch a few more containers onto a different subnet:
|
And then to test the isolation, launch a few more containers onto a different subnet:
|
||||||
|
|
||||||
host1$ docker run -e WEAVE_CIDR=net:10.2.2.0/24 --name b1 -ti weaveworks/ubuntu
|
host1$ docker run -e WEAVE_CIDR=net:10.2.2.0/24 --name b1 -ti weaveworks/ubuntu
|
||||||
host2$ docker run -e WEAVE_CIDR=net:10.2.2.0.24 --name b2 -ti weaveworks/ubuntu
|
host2$ docker run -e WEAVE_CIDR=net:10.2.2.0/24 --name b2 -ti weaveworks/ubuntu
|
||||||
|
|
||||||
Ping each container to confirm that they can talk to each other, but not to the containers of our first subnet:
|
Ping each container to confirm that they can talk to each other, but not to the containers of our first subnet:
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -89,7 +90,7 @@ your cluster.
|
|||||||
|
|
||||||
The Maximum Transmission Unit, or MTU, is the technical term for the
|
The Maximum Transmission Unit, or MTU, is the technical term for the
|
||||||
limit on how big a single packet can be on the network. Weave Net
|
limit on how big a single packet can be on the network. Weave Net
|
||||||
defaults to 1410 bytes. This default works across almost all networks, but for better
|
defaults to 1376 bytes. This default works across almost all networks, but for better
|
||||||
performance you can set it to a larger MTU size.
|
performance you can set it to a larger MTU size.
|
||||||
|
|
||||||
The AWS network supports packets of up to 9000 bytes.
|
The AWS network supports packets of up to 9000 bytes.
|
||||||
|
|||||||
@@ -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
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
@@ -18,9 +19,15 @@ You can disable fastdp by enabling the `WEAVE_NO_FASTDP` environment variable at
|
|||||||
|
|
||||||
### Fast Datapath and Encryption
|
### Fast Datapath and Encryption
|
||||||
|
|
||||||
Encryption does not work with fast datapath. If you enable encryption using the `--password` option to launch weave (or you use the `WEAVE_PASSWORD` environment variable), fast datapath will by default be disabled.
|
Fast datapath implements encryption using IPsec which is configured with IP
|
||||||
|
transformation framework (XFRM) provided by the Linux kernel.
|
||||||
|
|
||||||
When encryption is not in use there may be other conditions in which the fast datapath reverts to `sleeve mode`. Once these conditions pass, Weave Net reverts back to using fastdp. To view which mode Weave Net is using, run `weave status connections`.
|
Each encrypted dataplane packet is encapsulated into [ESP](https://tools.ietf.org/html/rfc2406),
|
||||||
|
thus in some networks a firewall rule for allowing ESP traffic needs to be installed. E.g. Google
|
||||||
|
Cloud Platform denies ESP packets by default.
|
||||||
|
|
||||||
|
See [How Weave Implements Encryption](/site/how-it-works/encryption-implementation.md)
|
||||||
|
for more details for the fastdp encryption.
|
||||||
|
|
||||||
### Viewing Connection Mode Fastdp or Sleeve
|
### Viewing Connection Mode Fastdp or Sleeve
|
||||||
|
|
||||||
@@ -46,12 +53,13 @@ Where fastdp indicates that fast datapath is being used on a connection. If fast
|
|||||||
|
|
||||||
The Maximum Transmission Unit, or MTU, is the technical term for the
|
The Maximum Transmission Unit, or MTU, is the technical term for the
|
||||||
limit on how big a single packet can be on the network. Weave Net
|
limit on how big a single packet can be on the network. Weave Net
|
||||||
defaults to 1410 bytes, but you can set a smaller size if your
|
defaults to 1376 bytes, but you can set a smaller size if your
|
||||||
underlying network has a tighter limit, or set a larger size for
|
underlying network has a tighter limit, or set a larger size for
|
||||||
better performance.
|
better performance.
|
||||||
|
|
||||||
The underlying network must be able to deliver packets of the size
|
The underlying network must be able to deliver packets of the size
|
||||||
specified plus overheads of around 50 bytes, or else Weave Net will
|
specified plus overheads of around 84-87 bytes (the final MTU should be
|
||||||
|
divisible by four), or else Weave Net will
|
||||||
fall back to Sleeve for that connection. This requirement applies
|
fall back to Sleeve for that connection. This requirement applies
|
||||||
to _every path_ between peers.
|
to _every path_ between peers.
|
||||||
|
|
||||||
@@ -59,7 +67,7 @@ To specify a different MTU, before launching Weave Net set the
|
|||||||
environment variable `WEAVE_MTU`. For example, for a typical "jumbo
|
environment variable `WEAVE_MTU`. For example, for a typical "jumbo
|
||||||
frame" configuration:
|
frame" configuration:
|
||||||
|
|
||||||
$ WEAVE_MTU=8950 weave launch host2 host3
|
$ WEAVE_MTU=8916 weave launch host2 host3
|
||||||
|
|
||||||
**See Also**
|
**See Also**
|
||||||
|
|
||||||
|
|||||||
@@ -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 the slower `sleeve` mode
|
connectivity. Otherwise communication is encrypted which imposes overheads.
|
||||||
is used and communication is encrypted.
|
|
||||||
|
|
||||||
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
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loaded 100 of 133 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user