From d2935ffed0018e0de76565d12dda03eb2be897b7 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Thu, 25 Jan 2018 18:44:20 +0300 Subject: [PATCH] Optionally ignore the presence of extra calico pools (#2190) --- roles/network_plugin/calico/defaults/main.yml | 3 +++ roles/network_plugin/calico/tasks/main.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/network_plugin/calico/defaults/main.yml b/roles/network_plugin/calico/defaults/main.yml index a44b3d315..902d01707 100644 --- a/roles/network_plugin/calico/defaults/main.yml +++ b/roles/network_plugin/calico/defaults/main.yml @@ -16,6 +16,9 @@ etcd_cert_dir: /etc/ssl/etcd/ssl # Global as_num (/calico/bgp/v1/global/as_num) global_as_num: "64512" +# Set to true if you need to configure multiple pools (this is not common) +calico_ignore_extra_pools: false + # You can set MTU value here. If left undefined or empty, it will # not be specified in calico CNI config, so Calico will use built-in # defaults. The value should be a number, not a string. diff --git a/roles/network_plugin/calico/tasks/main.yml b/roles/network_plugin/calico/tasks/main.yml index 2a2d2f6f8..b3cacaec4 100644 --- a/roles/network_plugin/calico/tasks/main.yml +++ b/roles/network_plugin/calico/tasks/main.yml @@ -142,7 +142,7 @@ fail: msg: 'Only one network pool must be configured and it must be the subnet {{ kube_pods_subnet }}. Please erase calico configuration and run the playbook again ("etcdctl rm --recursive /calico/v1/ipam/v4/pool")' - when: ( calico_pools['node']['nodes'] | length > 1 ) or + when: ( calico_pools['node']['nodes'] | length > 1 and not calico_ignore_extra_pools ) or ( not calico_pools['node']['nodes'][0]['key'] | search(".*{{ kube_pods_subnet | ipaddr('network') }}.*") ) run_once: true