From 7d7739e0311b8290aa257015c75a278caf1b2052 Mon Sep 17 00:00:00 2001
From: Etienne Champetier <champetier.etienne@gmail.com>
Date: Mon, 21 Dec 2020 03:58:25 -0500
Subject: [PATCH] Calico: fix node ip subnet detection (#7065)

We are currently setting the IP variable to hostIP,
Before https://github.com/projectcalico/node/pull/593 (not yet released)
Calico interpret that as hostIP/32
Using 'can-reach' we get the future behavior
This fixes vxlan and IPIP CrossSubnet modes

Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
---
 roles/network_plugin/calico/templates/calico-node.yml.j2 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/roles/network_plugin/calico/templates/calico-node.yml.j2 b/roles/network_plugin/calico/templates/calico-node.yml.j2
index f6fdb3991..1bbd800f6 100644
--- a/roles/network_plugin/calico/templates/calico-node.yml.j2
+++ b/roles/network_plugin/calico/templates/calico-node.yml.j2
@@ -230,10 +230,14 @@ spec:
             - name: IP
               value: "autodetect"
 {% else %}
-            - name: IP
+            - name: NODEIP
               valueFrom:
                 fieldRef:
                   fieldPath: status.hostIP
+            - name: IP_AUTODETECTION_METHOD
+              value: "can-reach=$(NODEIP)"
+            - name: IP
+              value: "autodetect"
 {% endif %}
 {% if calico_use_default_route_src_ipaddr|default(false) %}
             - name: FELIX_DEVICEROUTESOURCEADDRESS
-- 
GitLab