Compare commits

...
36 Commits
Author SHA1 Message Date
Martynas Pumputis 20919fd6db Add release v2.3.0 2018-04-09 14:56:31 +00:00
Martynas Pumputis ada2af04ff Merge pull request #3271 from weaveworks/metrics-addr
Only expose metrics by default in weave-kube
2018-04-09 15:05:22 +02:00
Bryan Boreham fcb6f762a9 Review feedback 2018-04-09 13:42:09 +01:00
Bryan Boreham 5645f31934 Update docs for metrics endpoints 2018-04-09 13:11:29 +01:00
Bryan Boreham a7295e2d03 Mention metrics and status addresses in the docs 2018-04-09 11:55:50 +01:00
Bryan Boreham c3e6ac2cac Merge pull request #3273 from weaveworks/go1.10.1
Use go1.10.1 for building
2018-04-09 11:40:11 +01:00
Martynas Pumputis f1f3c8c8fe Use go1.10.1 for building 2018-04-09 09:46:45 +02:00
Bryan Boreham 81b2f2e15a Merge pull request #3266 from weaveworks/test-k8s-1-10
Update tests to run against Kubernetes 1.10
2018-04-04 15:17:42 +01:00
Bryan Boreham f6fdaf6492 Only expose metrics by default in weave-kube 2018-04-04 15:00:53 +01:00
Bryan Boreham 519c5d686a Remove test for k8s 1.6 which breaks on 1.10 2018-04-04 12:26:18 +01:00
Bryan Boreham f7e62ccbcc Bump Kubernetes to 1.10 2018-04-04 12:26:09 +01:00
Bryan Boreham 19161c0c92 Merge branch '2.2' 2018-03-30 19:17:18 +00:00
Bryan Boreham c528303841 Merge pull request #3265 from weaveworks/raise-kube-conn-limit
Raise weave-kube default connection limit from 30 to 100
2018-03-28 10:20:30 +01:00
Bryan Boreham a439288765 Raise weave-kube default connection limit from 30 to 100
This was missed from 265bfcf
2018-03-27 21:06:41 +00:00
Bryan Boreham 416410912d Merge pull request #3263 from weaveworks/faq-unique-peers
Add 'peer names collision' to FAQ
2018-03-23 15:14:21 +00:00
Bryan Boreham b3f26f00e2 Add some hints how to set the unique ID 2018-03-23 14:55:54 +00:00
Bryan Boreham 90e6ecdd11 Add 'peer names collision' to FAQ 2018-03-23 14:10:05 +00:00
Marc Carré 842354bc5a Add links from email received from Docker Store. 2018-03-20 10:30:52 +00:00
Marc Carré 4d3875cec2 Add details on email for Docker Store release. 2018-03-20 10:29:50 +00:00
Marc Carré 74dfe49046 Fix format in Docker Store instructions. 2018-03-19 14:19:47 +00:00
Marc Carré d0f23ed9e0 Document Docker Store release process. 2018-03-19 11:49:40 +00:00
Martynas Pumputis 8a0992315e Merge branch '2.2' 2018-03-12 18:27:04 +01:00
Bryan Boreham 8afc6f208d Merge pull request #3253 from NathanHaim/issues/3245_change_golang_version
Update golang version to 1.10
2018-03-12 12:11:30 +00:00
Martynas Pumputis d35d931179 Fix invalid format in ipam/testutils_test.go
Caught after upgrading Go to 1.10 in build tools.
2018-03-12 11:04:41 +00:00
NathanHaim 093174e757 add golang:1.10.0 2018-03-11 23:08:41 +01:00
Martynas Pumputis ac78762910 Merge branch '2.2' 2018-03-08 14:38:46 +01:00
Martynas Pumputis 83b36e4c76 Merge branch '2.2' 2018-03-08 14:26:32 +01:00
Martynas Pumputis 42e4b9addc Merge pull request #3250 from alok87/del_default_ipset
Delete defaultAllowIPSet on namespace delete

Fix #3247
2018-03-08 14:01:10 +01:00
NathanHaim 51feec3785 change golang version 2018-03-05 02:46:35 +01:00
Bryan Boreham 94cd6226ea Merge branch '2.2' 2018-02-28 16:58:22 +00:00
Bryan Boreham d498df3933 Merge branch '2.2' 2018-02-28 10:32:45 +00:00
Marc Carré ad42357dd6 Improve formatting. 2018-02-21 10:31:04 +00:00
Marc Carré 2de899342a Improve naming consistency. 2018-02-21 10:30:35 +00:00
Marc Carré 8df48dc69d Document how to pull submodules on first checkout: git submodule update --init 2018-02-21 10:25:33 +00:00
Marc Carré 0f2809d2e9 Document how to pull submodules on first checkout: git submodule update --init 2018-02-21 10:23:08 +00:00
Marc Carré aa44153af7 Minor typos and improvements. 2018-02-21 10:19:38 +00:00
14 changed files with 121 additions and 44 deletions

No files matched your search

+19
View File
@@ -1,3 +1,22 @@
## Release 2.3.0
### Security fixes
* By default, do not expose Weave "/status" and "/report" to all (0.0.0.0) when
running on Kubernetes #3271
### Other improvements
* Increase the default connection limit for Weave peers (from 30 to 100) when
running on Kubernetes, so that more peers could directly connect #3265
## Build and test
* Build Weave Net with Go 1.10.1 #3273
* Run integration tests against Kubernetes 1.10.0 #3266
[Full list of changes](https://github.com/weaveworks/weave/milestone/70?closed=1)
## Release 2.2.1 ## Release 2.2.1
### Bug fixes ### Bug fixes
+1 -1
View File
@@ -1,3 +1,3 @@
DOCKER_VERSION=17.06 DOCKER_VERSION=17.06
KUBERNETES_VERSION=1.9.2 KUBERNETES_VERSION=1.10.0
KUBERNETES_CNI_VERSION=0.6.0 KUBERNETES_CNI_VERSION=0.6.0
+1 -1
View File
@@ -1,4 +1,4 @@
FROM golang:1.8.1 FROM golang:1.10.1-stretch
# Support Raspberry Pi 2 and newer # Support Raspberry Pi 2 and newer
ENV GOARM 7 ENV GOARM 7
+22
View File
@@ -127,6 +127,28 @@ Finally, for **Mainline** releases only:
* Images tagged `latest` are updated on DockerHub * Images tagged `latest` are updated on DockerHub
### Docker Store
Weave Net is [available in Docker Store](https://store.docker.com/plugins/weave-net-plugin) and should also be released there.
* Go to https://store.docker.com/ and log in.
* Go to "[_Publish_](https://store.docker.com/publisher/center)".
* Under "_My Products_", select "_owners (weaveworks)_". Weave Net should be listed among our products.
* Click "_Actions_" > "_Edit Product_".
* Go to "_Plans & Pricing_" > "_Free Tier_".
* Under "_Source Repositories & Tags_", click on "_Add Source_", select "_net-plugin_" under "_Repository_" and the version to release under "_Tag_".
* Under "_Resources_" > "_Installation Instructions_", update the lines containing `export NET_VERSION=<version>`.
* Click "_Submit For Review_". You should see a message like: "_Your product has been submitted for approval. [...] We'll be in touch with next steps soon!_".
* You should receive an email saying:
> This email confirms that we received your submission on \<date\> of Weave Net to the Docker Store.
>
> We're reviewing your submission to ensure that it meets our [security guidelines](https://success.docker.com/Store#Security_and_Audit_Policies) and complies with our [best practices](https://success.docker.com/Store#Create_Great_Content). Don't worry! We'll let you know if there's anything you need to change before we publish your submission. You should hear back from us within the next 14 days.
>
> Thanks for submitting your content to the Docker Store!
* Hope Docker eventually performs the release or contacts us. If nothing happens within 14 days, contact their support team: publisher-support@docker.com.
### Finish up ### Finish up
* If not on master, merge branch into master and push to GitHub. * If not on master, merge branch into master and push to GitHub.
+1 -1
View File
@@ -117,7 +117,7 @@ func CheckAllExpectedMessagesSent(allocs ...*Allocator) {
m := alloc.gossip.(*mockGossipComms) m := alloc.gossip.(*mockGossipComms)
m.RLock() m.RLock()
if len(m.messages) > 0 { if len(m.messages) > 0 {
require.FailNow(m, fmt.Sprintf("%s: Gossip message(s) not sent as expected: \n%x", m.name, m.messages)) require.FailNow(m, fmt.Sprintf("%s: Gossip message(s) not sent as expected: \n%v", m.name, m.messages))
} }
m.RUnlock() m.RUnlock()
} }
+9 -3
View File
@@ -27,9 +27,9 @@ xt_set_exists() {
# 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} METRICS_ADDR=${WEAVE_METRICS_ADDR:-0.0.0.0:6782}
HOST_ROOT=${HOST_ROOT:-/host} HOST_ROOT=${HOST_ROOT:-/host}
CONN_LIMIT=${CONN_LIMIT:-30} CONN_LIMIT=${CONN_LIMIT:-100}
DB_PREFIX=${DB_PREFIX:-/weavedb/weave-net} DB_PREFIX=${DB_PREFIX:-/weavedb/weave-net}
# Check if the IP range overlaps anything existing on the host # Check if the IP range overlaps anything existing on the host
@@ -54,6 +54,12 @@ else
fi fi
fi fi
STATUS_OPTS="--metrics-addr=$METRICS_ADDR"
# --status-addr exposes internal information, so only turn it on if asked to.
if [ -n "${WEAVE_STATUS_ADDR}" ]; then
STATUS_OPTS="$STATUS_OPTS --status-addr=$WEAVE_STATUS_ADDR"
fi
# Default is that npc will be running; allow caller to override # Default is that npc will be running; allow caller to override
WEAVE_NPC_OPTS="--expect-npc" WEAVE_NPC_OPTS="--expect-npc"
if [ "${EXPECT_NPC}" = "0" ]; then if [ "${EXPECT_NPC}" = "0" ]; then
@@ -144,7 +150,7 @@ post_start_actions &
/home/weave/weaver $EXTRA_ARGS --port=6783 $(router_bridge_opts) \ /home/weave/weaver $EXTRA_ARGS --port=6783 $(router_bridge_opts) \
--name="$PEERNAME" \ --name="$PEERNAME" \
--host-root=$HOST_ROOT \ --host-root=$HOST_ROOT \
--http-addr=$HTTP_ADDR --status-addr=$STATUS_ADDR --docker-api='' --no-dns \ --http-addr=$HTTP_ADDR $STATUS_OPTS --docker-api='' --no-dns \
--db-prefix="$DB_PREFIX" \ --db-prefix="$DB_PREFIX" \
--ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \ --ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \
--ipalloc-init $IPALLOC_INIT \ --ipalloc-init $IPALLOC_INIT \
+10 -1
View File
@@ -155,6 +155,7 @@ func main() {
noDiscovery bool noDiscovery bool
httpAddr string httpAddr string
statusAddr string statusAddr string
metricsAddr string
ipamConfig ipamConfig ipamConfig ipamConfig
dockerAPI string dockerAPI string
peers []string peers []string
@@ -192,6 +193,7 @@ func main() {
mflag.IntVar(&bridgeConfig.MTU, []string{"-mtu"}, 0, "MTU size") mflag.IntVar(&bridgeConfig.MTU, []string{"-mtu"}, 0, "MTU size")
mflag.StringVar(&httpAddr, []string{"-http-addr"}, "", "address to bind HTTP interface to (disabled if blank, absolute path indicates unix domain socket)") mflag.StringVar(&httpAddr, []string{"-http-addr"}, "", "address to bind HTTP interface to (disabled if blank, absolute path indicates unix domain socket)")
mflag.StringVar(&statusAddr, []string{"-status-addr"}, "", "address to bind status+metrics interface to (disabled if blank, absolute path indicates unix domain socket)") mflag.StringVar(&statusAddr, []string{"-status-addr"}, "", "address to bind status+metrics interface to (disabled if blank, absolute path indicates unix domain socket)")
mflag.StringVar(&metricsAddr, []string{"-metrics-addr"}, "", "address to bind metrics interface to (disabled if blank, absolute path indicates unix domain socket)")
mflag.StringVar(&ipamConfig.Mode, []string{"-ipalloc-init"}, "", "allocator initialisation strategy (consensus, seed or observer)") mflag.StringVar(&ipamConfig.Mode, []string{"-ipalloc-init"}, "", "allocator initialisation strategy (consensus, seed or observer)")
mflag.StringVar(&ipamConfig.IPRangeCIDR, []string{"-ipalloc-range"}, "", "IP address range reserved for automatic allocation, in CIDR notation") mflag.StringVar(&ipamConfig.IPRangeCIDR, []string{"-ipalloc-range"}, "", "IP address range reserved for automatic allocation, in CIDR notation")
mflag.StringVar(&ipamConfig.IPSubnetCIDR, []string{"-ipalloc-default-subnet"}, "", "subnet to allocate within by default, in CIDR notation") mflag.StringVar(&ipamConfig.IPSubnetCIDR, []string{"-ipalloc-default-subnet"}, "", "subnet to allocate within by default, in CIDR notation")
@@ -474,10 +476,17 @@ func main() {
muxRouter.Methods("GET").Path("/metrics").Handler(metricsHandler(router, allocator, ns, dnsserver)) muxRouter.Methods("GET").Path("/metrics").Handler(metricsHandler(router, allocator, ns, dnsserver))
statusMux := http.NewServeMux() statusMux := http.NewServeMux()
statusMux.Handle("/", muxRouter) statusMux.Handle("/", muxRouter)
Log.Println("Listening for metrics requests on", statusAddr) Log.Println("Listening for status+metrics requests on", statusAddr)
go listenAndServeHTTP(statusAddr, statusMux) go listenAndServeHTTP(statusAddr, statusMux)
} }
if metricsAddr != "" {
metricsMux := http.NewServeMux()
metricsMux.Handle("/metrics", metricsHandler(router, allocator, ns, dnsserver))
Log.Println("Listening for metrics requests on", metricsAddr)
go listenAndServeHTTP(metricsAddr, metricsMux)
}
if plugin != nil { if plugin != nil {
go plugin.Start(httpAddr, dockerCli, waitReady.Add()) go plugin.Start(httpAddr, dockerCli, waitReady.Add())
} }
+17 -15
View File
@@ -6,27 +6,28 @@ 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).
Apart from the `weave` shell script, weave is delivered as a set of Apart from the `weave` shell script, Weave Net is delivered as a set of
container images. There is no distribution-specific packaging, so in container images. There is no distribution-specific packaging, so in
principle it shouldn't matter which Linux distribution you build principle it shouldn't matter which Linux distribution you build
under. But naturally, Docker is a prerequisite (version 1.6.0 or under. But naturally, Docker is a prerequisite (version 1.6.0 or
later). later).
The only way to build is by using the the build container; the The only way to build is by using the the build container; the
Makefile is setup to make this transparent. This method is `Makefile` is setup to make this transparent. This method is
documented below, and can be run directly on your machine or using documented below, and can be run directly on your machine or using
a Vagrant VM. a Vagrant VM.
## <a name="ubuntu"></a>Building directly on your machine ## <a name="ubuntu"></a>Building directly on your machine
The weave git repository should be cloned into The weave git repository should be cloned into
`$GOPATH/src/github.com/weaveworks/weave`, in accordance with [the go `$GOPATH/src/github.com/weaveworks/weave`, in accordance with [the Go
workspace conventions](https://golang.org/doc/code.html#Workspaces): workspace conventions](https://golang.org/doc/code.html#Workspaces):
``` ```
$ WEAVE=github.com/weaveworks/weave $ WEAVE=github.com/weaveworks/weave
$ git clone https://$WEAVE $GOPATH/src/$WEAVE $ git clone https://$WEAVE $GOPATH/src/$WEAVE
$ cd $GOPATH/src/$WEAVE $ cd $GOPATH/src/$WEAVE
$ git submodule update --init
``` ```
Next install Docker if you haven't already, by following the instructions Next install Docker if you haven't already, by following the instructions
@@ -44,7 +45,7 @@ On a fresh repository, the Makefile will do the following:
- build the weave components in the build container - build the weave components in the build container
- package them into two Docker images (`weaveworks/weave`, - package them into two Docker images (`weaveworks/weave`,
`weaveworks/weaveexec`) `weaveworks/weaveexec`)
- Exported these images as `weave.tar.gz` - export these images as `weave.tar.gz`.
The first two steps may take a while - don't worry, they are The first two steps may take a while - don't worry, they are
are cached and should not need to be redone very often. are cached and should not need to be redone very often.
@@ -63,18 +64,19 @@ First, check out the code:
``` ```
$ git clone https://github.com/weaveworks/weave $ git clone https://github.com/weaveworks/weave
$ cd weave $ cd weave
$ git submodule update --init
``` ```
The `Vagrantfile` in the top directory constructs a VM that has The `Vagrantfile` in the top directory constructs a VM that has:
* docker installed * Docker installed
* go tools installed * Go tools installed
* weave dependencies installed * Weave's dependencies installed
* $GOPATH set to ~ * `$GOPATH` set to `~`
* the local working directory mapped as a synced folder into the * the local working directory mapped as a synced folder into the
right place in $GOPATH   right place in `$GOPATH`.
Once you are in the working directory you can issue Once you are in the working directory you can issue:
``` ```
$ vagrant up $ vagrant up
@@ -86,7 +88,7 @@ installation is done just once). The working directory is sync'ed with
use git and so on in the regular filesystem. use git and so on in the regular filesystem.
To build and run the code, you need to use the VM. To log in and build To build and run the code, you need to use the VM. To log in and build
the weave image, do the weave image, do:
``` ```
$ vagrant ssh $ vagrant ssh
@@ -94,7 +96,7 @@ vm$ cd src/github.com/weaveworks/weave
vm$ make vm$ make
``` ```
The Docker daemon is also running in this VM, so you can then do The Docker daemon is also running in this VM, so you can then do:
``` ```
vm$ sudo ./weave launch vm$ sudo ./weave launch
@@ -104,7 +106,7 @@ vm$ sudo docker ps
and so on. and so on.
If you are looking to just do a build and not run anything on this VM, If you are looking to just do a build and not run anything on this VM,
you can do so with you can do so with:
``` ```
$ vagrant ssh -c 'make -C src/github.com/weaveworks/weave' $ vagrant ssh -c 'make -C src/github.com/weaveworks/weave'
@@ -112,7 +114,7 @@ $ vagrant ssh -c 'make -C src/github.com/weaveworks/weave'
you should then find a `weave.tar.gz` container snapshot tarball in the you should then find a `weave.tar.gz` container snapshot tarball in the
top-level directory. You can use that snapshot with `docker load` top-level directory. You can use that snapshot with `docker load`
against a different host, e.g. against a different host, e.g.:
``` ```
$ export DOCKER_HOST=tcp://<HOST:PORT> $ export DOCKER_HOST=tcp://<HOST:PORT>
+12
View File
@@ -40,6 +40,18 @@ 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/tasks/manage/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/tasks/manage/service-management.md#exporting).
<a name="duplicate-peer"></a>
**Q: Why am I seeing "peer names collision" and failed connections?**
This sometimes happens when machines are cloned; we require each
machine in your cluster to have a unique identity.
For more information see [Peer Names](/site/operational-guide/concepts.md#peer-name).
Depending on your Linux distribution you may need to [set up
machine-id](https://www.freedesktop.org/software/systemd/man/machine-id.html)
or [generate a dbus id](https://dbus.freedesktop.org/doc/dbus-uuidgen.1.html).
<a name="duplicate-ip"></a> <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?**
+4
View File
@@ -346,6 +346,10 @@ The list of variables you can set is:
* `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_METRICS_ADDR` - address and port that the Weave Net
daemon will serve Prometheus-style metrics on (defaults to 0.0.0.0:6782)
* `WEAVE_STATUS_ADDR` - address and port that the Weave Net
daemon will serve status requests on (defaults to disabled)
* `WEAVE_MTU` - Weave Net defaults to 1376 bytes, but you can set a * `WEAVE_MTU` - Weave Net defaults to 1376 bytes, but you can set a
smaller size if your underlying network has a tighter limit, or set smaller size if your underlying network has a tighter limit, or set
a larger size for better performance if your network supports jumbo a larger size for better performance if your network supports jumbo
+22 -17
View File
@@ -10,9 +10,6 @@ controller](/site/kubernetes/kube-addon.md#npc).
### Router Metrics ### Router Metrics
The endpoint address is `localhost:6782`; the following metrics are
exposed:
* `weave_connections` - Number of peer-to-peer connections. * `weave_connections` - Number of peer-to-peer connections.
* `weave_connection_terminations_total` - Number of peer-to-peer * `weave_connection_terminations_total` - Number of peer-to-peer
connections terminated. connections terminated.
@@ -25,27 +22,35 @@ exposed:
* `weave_ipam_pending_allocates` - Number of pending allocates. * `weave_ipam_pending_allocates` - Number of pending allocates.
* `weave_ipam_pending_claims` - Number of pending claims. * `weave_ipam_pending_claims` - Number of pending claims.
#### Publish Router Metrics Endpoint
By default, when started via `weave launch`, weave listens on its local
interface to serve metrics. To publish your metrics throughout your cluster,
e.g. if your prometheus server is installed on a different host machine,
you need to set `WEAVE_STATUS_ADDR` to your corresponding IP and port.
Default port is 6782.
`WEAVE_STATUS_ADDR=X.X.X.X:PORT`
You can set `WEAVE_STATUS_ADDR=0.0.0.0:6782` to listen on all interfaces,
but be aware, this may expose your metrics to the public internet.
### Kubernetes Network Policy Controller Metrics ### Kubernetes Network Policy Controller Metrics
The endpoint address is `localhost:6781`; the following metric is The following metric is
exposed: exposed:
* `weavenpc_blocked_connections_total` - Connection attempts blocked * `weavenpc_blocked_connections_total` - Connection attempts blocked
by policy controller. by policy controller.
### Metrics Endpoint Addresses
When installed as a Kubernetes Addon, the router listens for metrics
requests on 0.0.0.0:6782 and the Network Policy Controller listens on
0.0.0.0:6781. No other requests are served on these endpoints.
>Note: If your Kubernetes hosts are exposed to the public internet
then these metrics endpoints will also be exposed.
When started via `weave launch`, by default weave listens on its local
interface to serve metrics and other read-only status requests. To
publish your metrics throughout your cluster, you can set
`WEAVE_STATUS_ADDR`:
`WEAVE_STATUS_ADDR=X.X.X.X:PORT`
Set it to an empty string to disable.
You can also pass the parameter `--metrics-addr=X.X.X.X:PORT` to
`weave launch` to specify an address to listen for metrics only.
# Static Configuration for Weave Net # Static Configuration for Weave Net
The following YAML fragment can be used in your Prometheus configuration to The following YAML fragment can be used in your Prometheus configuration to
+1 -2
View File
@@ -34,11 +34,10 @@ docker_on $HOST1 run --rm --privileged --net=host --entrypoint=/usr/sbin/ipset w
# kubeadm init upgrades to latest Kubernetes version by default, therefore we try to lock the version using the below option: # kubeadm init upgrades to latest Kubernetes version by default, therefore we try to lock the version using the below option:
k8s_version="$(run_on $HOST1 "kubelet --version" | grep -oP "(?<=Kubernetes )v[\d\.\-beta]+")" k8s_version="$(run_on $HOST1 "kubelet --version" | grep -oP "(?<=Kubernetes )v[\d\.\-beta]+")"
k8s_version_option="$([[ "$k8s_version" > "v1.6" ]] && echo "kubernetes-version" || echo "use-kubernetes-version")"
for host in $HOSTS; do for host in $HOSTS; do
if [ $host = $HOST1 ] ; then if [ $host = $HOST1 ] ; then
run_on $host "sudo systemctl start kubelet && sudo kubeadm init --$k8s_version_option=$k8s_version --token=$TOKEN --pod-network-cidr=$WEAVE_NETWORK" run_on $host "sudo systemctl start kubelet && sudo kubeadm init --kubernetes-version=$k8s_version --token=$TOKEN --pod-network-cidr=$WEAVE_NETWORK"
else else
run_on $host "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN --discovery-token-unsafe-skip-ca-verification $HOST1IP:$KUBE_PORT" run_on $host "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN --discovery-token-unsafe-skip-ca-verification $HOST1IP:$KUBE_PORT"
fi fi
@@ -38,11 +38,10 @@ function setup_kubernetes_cluster {
# kubeadm init upgrades to latest Kubernetes version by default, therefore we try to lock the version using the below option: # kubeadm init upgrades to latest Kubernetes version by default, therefore we try to lock the version using the below option:
k8s_version="$(run_on $HOST1 "kubelet --version" | grep -oP "(?<=Kubernetes )v[\d\.\-beta]+")" k8s_version="$(run_on $HOST1 "kubelet --version" | grep -oP "(?<=Kubernetes )v[\d\.\-beta]+")"
k8s_version_option="$([[ "$k8s_version" > "v1.6" ]] && echo "kubernetes-version" || echo "use-kubernetes-version")"
for host in $HOSTS; do for host in $HOSTS; do
if [ $host = $HOST1 ] ; then if [ $host = $HOST1 ] ; then
run_on $host "sudo systemctl start kubelet && sudo kubeadm init --$k8s_version_option=$k8s_version --token=$TOKEN" run_on $host "sudo systemctl start kubelet && sudo kubeadm init --kubernetes-version=$k8s_version --token=$TOKEN"
else else
run_on $host "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN --discovery-token-unsafe-skip-ca-verification $HOST1IP:$KUBE_PORT" run_on $host "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN --discovery-token-unsafe-skip-ca-verification $HOST1IP:$KUBE_PORT"
fi fi
+1 -1
View File
@@ -16,7 +16,7 @@ def ansibleize(h)
end end
def get_go_version_from_build_dockerfile() def get_go_version_from_build_dockerfile()
go_regexp = /FROM golang:(\S*).*?/ go_regexp = /FROM golang:([\d\.]*).*?/
dockerfile_path = File.expand_path(File.join(File.dirname(__FILE__), 'build', 'Dockerfile')) dockerfile_path = File.expand_path(File.join(File.dirname(__FILE__), 'build', 'Dockerfile'))
go_version = File.readlines(dockerfile_path).select { |line| line.match(go_regexp) }.first.match(go_regexp).captures.first go_version = File.readlines(dockerfile_path).select { |line| line.match(go_regexp) }.first.match(go_regexp).captures.first
if go_version.nil? if go_version.nil?