From d469282f1cecd4e1a2c93af5e2bfeaff67c09505 Mon Sep 17 00:00:00 2001
From: chadswilson <44215533+chadswilson@users.noreply.github.com>
Date: Wed, 6 Mar 2019 14:42:48 -0600
Subject: [PATCH] add blockSize to IPPool spec for Calico >= v3.3.0 (#4224)

* add blockSize to IPPool spec for Calico >= v3.3.0

* fix "cidr" spec in Calico IPPool resource for my PR
---
 roles/network_plugin/calico/tasks/install.yml | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/roles/network_plugin/calico/tasks/install.yml b/roles/network_plugin/calico/tasks/install.yml
index a80cd9e25..28cdb07a2 100644
--- a/roles/network_plugin/calico/tasks/install.yml
+++ b/roles/network_plugin/calico/tasks/install.yml
@@ -93,7 +93,7 @@
     - 'calico_conf.stdout == "0"'
     - calico_pool_cidr is defined
 
-- name: Calico | Configure calico network pool
+- name: Calico | Configure calico network pool (v3.0.0 <= version < v3.3.0)
   shell: >
     echo "
       { "kind": "IPPool",
@@ -110,6 +110,26 @@
   when:
     - 'calico_conf.stdout == "0"'
     - calico_version is version("v3.0.0", ">=")
+    - calico_version is version("v3.3.0", "<")
+
+- name: Calico | Configure calico network pool (version >= v3.3.0)
+  shell: >
+    echo "
+      { "kind": "IPPool",
+        "apiVersion": "projectcalico.org/v3",
+        "metadata": {
+          "name": "{{ calico_pool_name }}",
+        },
+        "spec": {
+          "blockSize": "{{ kube_network_node_prefix }}",
+          "cidr": "{{ calico_pool_cidr | default(kube_pods_subnet) }}",
+          "ipipMode": "{{ ipip_mode }}",
+          "natOutgoing": {{ nat_outgoing|default(false) and not peer_with_router|default(false) }} }} " | {{ bin_dir }}/calicoctl create -f -
+  run_once: true
+  delegate_to: "{{ groups['kube-master'][0] }}"
+  when:
+    - 'calico_conf.stdout == "0"'
+    - calico_version is version("v3.3.0", ">=")
 
 - name: Calico | Configure calico network pool (legacy)
   shell: >
-- 
GitLab