From 3eb0a4071a1aca74831ad956cf068c3e52618d45 Mon Sep 17 00:00:00 2001
From: Cyclinder <qifeng.guo@daocloud.io>
Date: Thu, 12 May 2022 23:29:14 +0800
Subject: [PATCH] set default value of name to "k8s-pod-network" (#8813)

Signed-off-by: cyclinder qifeng.guo@daocloud.io
---
 inventory/sample/group_vars/k8s_cluster/k8s-net-calico.yml   | 4 ++++
 roles/network_plugin/calico/defaults/main.yml                | 3 +++
 roles/network_plugin/calico/templates/cni-calico.conflist.j2 | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

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 34bb11960..bcf7827d4 100644
--- a/inventory/sample/group_vars/k8s_cluster/k8s-net-calico.yml
+++ b/inventory/sample/group_vars/k8s_cluster/k8s-net-calico.yml
@@ -1,5 +1,9 @@
+---
 # see roles/network_plugin/calico/defaults/main.yml
 
+# the default value of name
+calico_cni_name: k8s-pod-network
+
 ## With calico it is possible to distributed routes with border routers of the datacenter.
 ## Warning : enabling router peering will disable calico's default behavior ('node mesh').
 ## The subnets of each nodes will be distributed by the datacenter router
diff --git a/roles/network_plugin/calico/defaults/main.yml b/roles/network_plugin/calico/defaults/main.yml
index ae1b65dc1..9e947ec70 100644
--- a/roles/network_plugin/calico/defaults/main.yml
+++ b/roles/network_plugin/calico/defaults/main.yml
@@ -1,4 +1,7 @@
 ---
+# the default value of name
+calico_cni_name: k8s-pod-network
+
 # Enables Internet connectivity from containers
 nat_outgoing: true
 
diff --git a/roles/network_plugin/calico/templates/cni-calico.conflist.j2 b/roles/network_plugin/calico/templates/cni-calico.conflist.j2
index acac05f51..13d0a2367 100644
--- a/roles/network_plugin/calico/templates/cni-calico.conflist.j2
+++ b/roles/network_plugin/calico/templates/cni-calico.conflist.j2
@@ -1,5 +1,5 @@
 {
-  "name": "cni0",
+  "name": "{{ calico_cni_name }}",
   "cniVersion":"0.3.1",
   "plugins":[
     {
-- 
GitLab