From 9ebdf0e3cf9a197f1d302cbc30a75e3cc6bc061a Mon Sep 17 00:00:00 2001
From: Wong Hoi Sing Edison <hswong3i@gmail.com>
Date: Thu, 15 Nov 2018 15:38:51 +0800
Subject: [PATCH] weave: Upgrade to 2.5.0 (#3660)

* weave: Upgrade to 2.5.0

Upstream Changes:

-   weave 2.5.0 (https://github.com/weaveworks/weave/releases/tag/v2.5.0)
-   Adds support for Kubernetes `hostPort` mapping
-   Adds support for Kubernetes `ipBlock` NetworkPolicy feature

Our Changes:

-   Templates sync with upstream manifests
-   Remove legacy nodePort fix

* BC for weave < 2.5.0
---
 README.md                                                   | 2 +-
 roles/download/defaults/main.yml                            | 3 +--
 roles/network_plugin/weave/tasks/main.yml                   | 4 ++--
 .../{00-weave.conflist.j2 => 10-weave.conflist.j2}          | 4 ++--
 roles/network_plugin/weave/templates/weave-net.yml.j2       | 6 ++----
 5 files changed, 8 insertions(+), 11 deletions(-)
 rename roles/network_plugin/weave/templates/{00-weave.conflist.j2 => 10-weave.conflist.j2} (75%)

diff --git a/README.md b/README.md
index 74986a9b4..9488d0120 100644
--- a/README.md
+++ b/README.md
@@ -122,9 +122,9 @@ Supported Components
     -   [cilium](https://github.com/cilium/cilium) v1.3.0
     -   [contiv](https://github.com/contiv/install) v1.1.7
     -   [flanneld](https://github.com/coreos/flannel) v0.10.0
-    -   [weave](https://github.com/weaveworks/weave) v2.4.1
     -   [kube-router](https://github.com/cloudnativelabs/kube-router) v0.2.1
     -   [multus](https://github.com/intel/multus-cni) v3.1
+    -   [weave](https://github.com/weaveworks/weave) v2.5.0
 -   Application
     -   [cephfs-provisioner](https://github.com/kubernetes-incubator/external-storage) v2.1.0-k8s1.11
     -   [cert-manager](https://github.com/jetstack/cert-manager) v0.5.0
diff --git a/roles/download/defaults/main.yml b/roles/download/defaults/main.yml
index e924465a0..5dc7aa334 100644
--- a/roles/download/defaults/main.yml
+++ b/roles/download/defaults/main.yml
@@ -53,8 +53,7 @@ calico_rr_version: "v0.6.1"
 flannel_version: "v0.10.0"
 flannel_cni_version: "v0.3.0"
 
-
-weave_version: "2.4.1"
+weave_version: 2.5.0
 pod_infra_version: 3.1
 contiv_version: 1.2.1
 cilium_version: "v1.3.0"
diff --git a/roles/network_plugin/weave/tasks/main.yml b/roles/network_plugin/weave/tasks/main.yml
index 318b6a369..a9922cf3f 100644
--- a/roles/network_plugin/weave/tasks/main.yml
+++ b/roles/network_plugin/weave/tasks/main.yml
@@ -18,5 +18,5 @@
 
 - name: Weave | Fix nodePort for Weave
   template:
-    src: 00-weave.conflist.j2
-    dest: /etc/cni/net.d/00-weave.conflist
+    src: 10-weave.conflist.j2
+    dest: /etc/cni/net.d/10-weave.conflist
diff --git a/roles/network_plugin/weave/templates/00-weave.conflist.j2 b/roles/network_plugin/weave/templates/10-weave.conflist.j2
similarity index 75%
rename from roles/network_plugin/weave/templates/00-weave.conflist.j2
rename to roles/network_plugin/weave/templates/10-weave.conflist.j2
index 45ae0b967..9aab7e98c 100644
--- a/roles/network_plugin/weave/templates/00-weave.conflist.j2
+++ b/roles/network_plugin/weave/templates/10-weave.conflist.j2
@@ -1,11 +1,11 @@
 {
     "cniVersion": "0.3.0",
-    "name": "mynet",
+    "name": "weave",
       "plugins": [
         {
             "name": "weave",
             "type": "weave-net",
-            "hairpinMode": true
+            "hairpinMode": {{ weave_hairpin_mode | bool | lower }}
         },
         {
             "type": "portmap",
diff --git a/roles/network_plugin/weave/templates/weave-net.yml.j2 b/roles/network_plugin/weave/templates/weave-net.yml.j2
index 6c07a7ee8..204e3f993 100644
--- a/roles/network_plugin/weave/templates/weave-net.yml.j2
+++ b/roles/network_plugin/weave/templates/weave-net.yml.j2
@@ -141,7 +141,7 @@ items:
                 - name: CONN_LIMIT
                   value: "{{ weave_conn_limit | int }}"
                 - name: HAIRPIN_MODE
-                  value: "{{ weave_hairpin_mode | bool }}"
+                  value: "{{ weave_hairpin_mode | bool | lower }}"
                 - name: IPALLOC_RANGE
                   value: "{{ weave_ipalloc_range }}"
                 - name: EXPECT_NPC
@@ -176,12 +176,11 @@ items:
 {% endif %}
               image: {{ weave_kube_image_repo }}:{{ weave_kube_image_tag }}
               imagePullPolicy: {{ k8s_image_pull_policy }}
-              livenessProbe:
+              readinessProbe:
                 httpGet:
                   host: 127.0.0.1
                   path: /status
                   port: 6784
-                initialDelaySeconds: 30
               resources:
                 requests:
                   cpu: 10m
@@ -203,7 +202,6 @@ items:
                 - name: xtables-lock
                   mountPath: /run/xtables.lock
             - name: weave-npc
-              args: []
               env:
                 - name: HOSTNAME
                   valueFrom:
-- 
GitLab