From b91e92b0b7fcb9b911e849f0c4680ac86a57b993 Mon Sep 17 00:00:00 2001 From: Mehdi El Kouhen Date: Tue, 31 Dec 2019 09:23:40 +0100 Subject: [PATCH 1/5] install weave network --- tasks/master-setup.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tasks/master-setup.yml b/tasks/master-setup.yml index b9d1994..2986ffc 100644 --- a/tasks/master-setup.yml +++ b/tasks/master-setup.yml @@ -45,6 +45,22 @@ changed_when: "'created' in calico_result.stdout" when: kubernetes_pod_network.cni == 'calico' +# LINT-ERROR +- name: "Get K8s version" + shell: | + set -o pipefail + kubectl version | base64 | tr -d '\n' + register: k8_version + when: kubernetes_pod_network.cni == 'weave' + +- name: Configure Weave networking. + command: "{{ item }}" + with_items: + - "kubectl apply -f https://cloud.weave.works/k8s/net?k8s-version={{ k8_version.stdout_lines[0] }}" + register: weave_result + changed_when: "'created' in weave_result.stdout" + when: kubernetes_pod_network.cni == 'weave' + # TODO: Check if taint exists with something like `kubectl describe nodes` # instead of using kubernetes_init_stat.stat.exists check. - name: Allow pods on master node (if configured). From c49661ba06cd3d6b773db51b4b60e600c2572ad2 Mon Sep 17 00:00:00 2001 From: Mehdi El Kouhen Date: Tue, 31 Dec 2019 09:24:26 +0100 Subject: [PATCH 2/5] install weave network --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ee4af9d..df74619 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,10 @@ Whether to enable the Kubernetes web dashboard UI (only accessible on the master # Calico CNI. # cni: 'calico' # cidr: '192.168.0.0/16' - + # Weave CNI. + # cni: 'weave' + # cidr: '192.168.0.0/16' + This role currently supports `flannel` (default) or `calico` for cluster pod networking. Choose one or the other for your cluster; converting between the two is not done automatically and could result in broken networking, and should be done outside of this role. kubernetes_apiserver_advertise_address: '' From 4b7f0f1e5106b038733312273b1f7321d17df776 Mon Sep 17 00:00:00 2001 From: EL KOUHEN Mehdi Date: Tue, 31 Dec 2019 09:48:07 +0100 Subject: [PATCH 3/5] Remove Lint Error Comment --- tasks/master-setup.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/master-setup.yml b/tasks/master-setup.yml index 2986ffc..b0b231d 100644 --- a/tasks/master-setup.yml +++ b/tasks/master-setup.yml @@ -45,7 +45,6 @@ changed_when: "'created' in calico_result.stdout" when: kubernetes_pod_network.cni == 'calico' -# LINT-ERROR - name: "Get K8s version" shell: | set -o pipefail From f149d3b35866f7155c624c2d8903fba7af8bd1d9 Mon Sep 17 00:00:00 2001 From: EL KOUHEN Mehdi Date: Tue, 31 Dec 2019 10:01:23 +0100 Subject: [PATCH 4/5] Remove option pipefail --- tasks/master-setup.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tasks/master-setup.yml b/tasks/master-setup.yml index b0b231d..b27b8cd 100644 --- a/tasks/master-setup.yml +++ b/tasks/master-setup.yml @@ -46,9 +46,7 @@ when: kubernetes_pod_network.cni == 'calico' - name: "Get K8s version" - shell: | - set -o pipefail - kubectl version | base64 | tr -d '\n' + shell: kubectl version | base64 | tr -d '\n' register: k8_version when: kubernetes_pod_network.cni == 'weave' From 0d0f8e8192a7dfb800f53d672cb1922e4096d9a7 Mon Sep 17 00:00:00 2001 From: EL KOUHEN Mehdi Date: Mon, 6 Jan 2020 11:00:34 +0100 Subject: [PATCH 5/5] update documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index df74619..9b15997 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Whether to enable the Kubernetes web dashboard UI (only accessible on the master # cni: 'weave' # cidr: '192.168.0.0/16' -This role currently supports `flannel` (default) or `calico` for cluster pod networking. Choose one or the other for your cluster; converting between the two is not done automatically and could result in broken networking, and should be done outside of this role. +This role currently supports `flannel` (default), `calico` or `weave` for cluster pod networking. Choose one or the other for your cluster; converting between the three is not done automatically and could result in broken networking, and should be done outside of this role. kubernetes_apiserver_advertise_address: '' kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}'