From b061cce913604b3b424038896c13e4019aec382c Mon Sep 17 00:00:00 2001 From: Ryler Hockenbury Date: Wed, 15 Apr 2020 06:14:02 -0400 Subject: [PATCH] Allow configureable vni and port for flannel overlay (#5939) --- inventory/sample/group_vars/k8s-cluster/k8s-net-flannel.yml | 2 ++ roles/network_plugin/flannel/defaults/main.yml | 2 ++ roles/network_plugin/flannel/templates/cni-flannel.yml.j2 | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/inventory/sample/group_vars/k8s-cluster/k8s-net-flannel.yml b/inventory/sample/group_vars/k8s-cluster/k8s-net-flannel.yml index be1245a42..a42c5b3be 100644 --- a/inventory/sample/group_vars/k8s-cluster/k8s-net-flannel.yml +++ b/inventory/sample/group_vars/k8s-cluster/k8s-net-flannel.yml @@ -14,3 +14,5 @@ # for experimental backend # please refer to flannel's docs : https://github.com/coreos/flannel/blob/master/README.md # flannel_backend_type: "vxlan" +# flannel_vxlan_vni: 1 +# flannel_vxlan_port: 8472 diff --git a/roles/network_plugin/flannel/defaults/main.yml b/roles/network_plugin/flannel/defaults/main.yml index 09b18fd3b..b07513517 100644 --- a/roles/network_plugin/flannel/defaults/main.yml +++ b/roles/network_plugin/flannel/defaults/main.yml @@ -17,6 +17,8 @@ # You can choose what type of flannel backend to use # please refer to flannel's docs : https://github.com/coreos/flannel/blob/master/README.md flannel_backend_type: "vxlan" +flannel_vxlan_vni: 1 +flannel_vxlan_port: 8472 # Limits for apps flannel_memory_limit: 500M diff --git a/roles/network_plugin/flannel/templates/cni-flannel.yml.j2 b/roles/network_plugin/flannel/templates/cni-flannel.yml.j2 index 135be5c94..f654a4e83 100644 --- a/roles/network_plugin/flannel/templates/cni-flannel.yml.j2 +++ b/roles/network_plugin/flannel/templates/cni-flannel.yml.j2 @@ -32,7 +32,10 @@ data: { "Network": "{{ kube_pods_subnet }}", "Backend": { - "Type": "{{ flannel_backend_type }}" + "Type": "{{ flannel_backend_type }}"{% if flannel_backend_type == "vxlan" %}, + "VNI": {{ flannel_vxlan_vni }}, + "Port": {{ flannel_vxlan_port }} +{% endif %} } } ---