From dd9d0c05301fe1229aeabc5e53a1bc41c1bd68a0 Mon Sep 17 00:00:00 2001 From: Anton Fayzrahmanov Date: Fri, 23 Mar 2018 16:33:20 +0300 Subject: [PATCH 1/3] optional calico_ip_auto_method variable with IP_AUTODETECTION_METHOD can be set to one of first-found can-reach interface --- roles/network_plugin/calico/templates/calico-node.yml.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/network_plugin/calico/templates/calico-node.yml.j2 b/roles/network_plugin/calico/templates/calico-node.yml.j2 index 3a01648f7..45023d0cf 100644 --- a/roles/network_plugin/calico/templates/calico-node.yml.j2 +++ b/roles/network_plugin/calico/templates/calico-node.yml.j2 @@ -108,10 +108,15 @@ spec: configMapKeyRef: name: calico-config key: etcd_cert +{% if calico_ip_auto_method is defined %} + - name: IP_AUTODETECTION_METHOD + value: "{{ calico_ip_auto_method }}" +{% else %} - name: IP valueFrom: fieldRef: fieldPath: status.hostIP +{% endif %} - name: NODENAME valueFrom: fieldRef: From 60a057cace3c36699e19e98516a9280d2161496a Mon Sep 17 00:00:00 2001 From: Anton Fayzrahmanov Date: Sat, 24 Mar 2018 01:46:26 +0300 Subject: [PATCH 2/3] Update calico-node.yml.j2 --- roles/network_plugin/calico/templates/calico-node.yml.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/network_plugin/calico/templates/calico-node.yml.j2 b/roles/network_plugin/calico/templates/calico-node.yml.j2 index 45023d0cf..139493b62 100644 --- a/roles/network_plugin/calico/templates/calico-node.yml.j2 +++ b/roles/network_plugin/calico/templates/calico-node.yml.j2 @@ -109,8 +109,8 @@ spec: name: calico-config key: etcd_cert {% if calico_ip_auto_method is defined %} - - name: IP_AUTODETECTION_METHOD - value: "{{ calico_ip_auto_method }}" + - name: IP_AUTODETECTION_METHOD + value: "{{ calico_ip_auto_method }}" {% else %} - name: IP valueFrom: From a75598b3f44dc04a408156c226bfb36bce9cf9a4 Mon Sep 17 00:00:00 2001 From: Anton Fayzrahmanov Date: Sat, 24 Mar 2018 01:54:17 +0300 Subject: [PATCH 3/3] IP_AUTODETECTION_METHOD docs --- roles/network_plugin/calico/defaults/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/network_plugin/calico/defaults/main.yml b/roles/network_plugin/calico/defaults/main.yml index a44b3d315..1b0cd0421 100644 --- a/roles/network_plugin/calico/defaults/main.yml +++ b/roles/network_plugin/calico/defaults/main.yml @@ -45,3 +45,9 @@ rbac_resources: - sa - clusterrole - clusterrolebinding + +# If you want to use non default IP_AUTODETECTION_METHOD for calico node set this option to one of: +# * can-reach=DESTINATION +# * interface=INTERFACE-REGEX +# see https://docs.projectcalico.org/v3.0/reference/node/configuration#ip-autodetection-methods +#calico_ip_auto_method: "interface=eth.*"