From 1e79dcfcaa0547f07a9c8e7fddeaa2e21988c045 Mon Sep 17 00:00:00 2001 From: David Louks <2402775+dlouks@users.noreply.github.com> Date: Tue, 22 Sep 2020 03:04:48 -0500 Subject: [PATCH] =?UTF-8?q?Added=20ability=20to=20set=20calico=20vxlan=20v?= =?UTF-8?q?ni=20and=20port.=20defaults=20to=20calico's=20=E2=80=A6=20(#667?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added ability to set calico vxlan vni and port. defaults to calico's documented defaults. * Check if calico_network_backend is defined prior to checking value * Removed calico hidden defaults for vxlan port and vni * Fixed FELIX_VXLANVNI typo --- inventory/sample/group_vars/k8s-cluster/k8s-net-calico.yml | 4 ++++ roles/network_plugin/calico/defaults/main.yml | 6 ++++++ roles/network_plugin/calico/templates/calico-node.yml.j2 | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/inventory/sample/group_vars/k8s-cluster/k8s-net-calico.yml b/inventory/sample/group_vars/k8s-cluster/k8s-net-calico.yml index 2c70129e5..5badefd40 100644 --- a/inventory/sample/group_vars/k8s-cluster/k8s-net-calico.yml +++ b/inventory/sample/group_vars/k8s-cluster/k8s-net-calico.yml @@ -68,6 +68,10 @@ # set VXLAN encapsulation mode: "Always", "CrossSubnet", "Never" # calico_vxlan_mode: 'Never' +# set VXLAN port and VNI +# calico_vxlan_vni: 4096 +# calico_vxlan_port: 4789 + # 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 diff --git a/roles/network_plugin/calico/defaults/main.yml b/roles/network_plugin/calico/defaults/main.yml index b8ed03393..f183606c2 100644 --- a/roles/network_plugin/calico/defaults/main.yml +++ b/roles/network_plugin/calico/defaults/main.yml @@ -29,6 +29,12 @@ calico_node_memory_requests: 64M calico_node_cpu_requests: 150m calico_felix_chaininsertmode: Insert +# Virtual network ID to use for VXLAN traffic. A value of 0 means “use the kernel default”. +calico_vxlan_vni: 4096 + +# Port to use for VXLAN traffic. A value of 0 means “use the kernel default”. +calico_vxlan_port: 4789 + # Enable Prometheus Metrics endpoint for felix calico_felix_prometheusmetricsenabled: false calico_felix_prometheusmetricsport: 9091 diff --git a/roles/network_plugin/calico/templates/calico-node.yml.j2 b/roles/network_plugin/calico/templates/calico-node.yml.j2 index 14366c33d..4f54a4e31 100644 --- a/roles/network_plugin/calico/templates/calico-node.yml.j2 +++ b/roles/network_plugin/calico/templates/calico-node.yml.j2 @@ -173,6 +173,12 @@ spec: # Wait for the datastore. - name: WAIT_FOR_DATASTORE value: "true" +{% endif %} +{% if calico_network_backend is defined and calico_network_backend == 'vxlan' %} + - name: FELIX_VXLANVNI + value: "{{ calico_vxlan_vni }}" + - name: FELIX_VXLANPORT + value: "{{ calico_vxlan_port }}" {% endif %} # Choose the backend to use. - name: CALICO_NETWORKING_BACKEND