From d821bed2ea9076c98d5ff7cf60bd739365179542 Mon Sep 17 00:00:00 2001
From: Samuel Liu <liupeng0518@gmail.com>
Date: Tue, 12 Jul 2022 00:49:48 +0800
Subject: [PATCH] Fix some typo (#9056)

* fix ingress controller task name

* fix calico word

* add check typo
---
 .../ingress_controller/ingress_nginx/tasks/main.yml      | 2 +-
 roles/network_plugin/calico/defaults/main.yml            | 2 +-
 roles/network_plugin/calico/tasks/check.yml              | 9 +++++++++
 .../calico/templates/calico-ipamconfig.yml.j2            | 2 +-
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/roles/kubernetes-apps/ingress_controller/ingress_nginx/tasks/main.yml b/roles/kubernetes-apps/ingress_controller/ingress_nginx/tasks/main.yml
index 363835d7d..d99b6c265 100644
--- a/roles/kubernetes-apps/ingress_controller/ingress_nginx/tasks/main.yml
+++ b/roles/kubernetes-apps/ingress_controller/ingress_nginx/tasks/main.yml
@@ -39,7 +39,7 @@
     ingress_nginx_templates: "{{ ingress_nginx_templates_for_psp + ingress_nginx_templates }}"
   when: podsecuritypolicy_enabled
 
-- name: NGINX Ingress Controller | Append extra templates to NGINX Ingress Templates list for PodSecurityPolicy
+- name: NGINX Ingress Controller | Append extra templates to NGINX Ingress Templates list for webhook
   set_fact:
     ingress_nginx_templates: "{{ ingress_nginx_templates + ingress_nginx_templates_for_webhook }}"
   when: ingress_nginx_webhook_enabled
diff --git a/roles/network_plugin/calico/defaults/main.yml b/roles/network_plugin/calico/defaults/main.yml
index 2ba53d362..e77114244 100644
--- a/roles/network_plugin/calico/defaults/main.yml
+++ b/roles/network_plugin/calico/defaults/main.yml
@@ -143,7 +143,7 @@ calico_allow_ip_forwarding: false
 calico_ipam_strictaffinity: false
 
 # Calico IPAM autoAllocateBlocks
-calcio_ipam_autoallocateblocks: true
+calico_ipam_autoallocateblocks: true
 
 # Calico IPAM maxBlocksPerHost, default 0
 calico_ipam_maxblocksperhost: 0
diff --git a/roles/network_plugin/calico/tasks/check.yml b/roles/network_plugin/calico/tasks/check.yml
index cdb9b30f8..1fe4440f1 100644
--- a/roles/network_plugin/calico/tasks/check.yml
+++ b/roles/network_plugin/calico/tasks/check.yml
@@ -15,6 +15,15 @@
   run_once: True
   delegate_to: "{{ groups['kube_control_plane'][0] }}"
 
+- name: Stop if legacy encapsulation variables are detected (calcio_ipam_autoallocateblocks)
+  assert:
+    that:
+      - calcio_ipam_autoallocateblocks is not defined
+    msg: "'calcio_ipam_autoallocateblocks' configuration variable is deprecated, it's a typo, please configure your inventory with 'calico_ipam_autoallocateblocks' set to 'true' or 'false' according to your specific needs"
+  run_once: True
+  delegate_to: "{{ groups['kube_control_plane'][0] }}"
+
+
 - name: Stop if incompatible network plugin and cloudprovider
   assert:
     that:
diff --git a/roles/network_plugin/calico/templates/calico-ipamconfig.yml.j2 b/roles/network_plugin/calico/templates/calico-ipamconfig.yml.j2
index 3cb85c1bf..af7e2117c 100644
--- a/roles/network_plugin/calico/templates/calico-ipamconfig.yml.j2
+++ b/roles/network_plugin/calico/templates/calico-ipamconfig.yml.j2
@@ -3,6 +3,6 @@ kind: IPAMConfig
 metadata:
   name: default
 spec:
-  autoAllocateBlocks: {{ calcio_ipam_autoallocateblocks }}
+  autoAllocateBlocks: {{ calico_ipam_autoallocateblocks }}
   strictAffinity: {{ calico_ipam_strictaffinity }}
   maxBlocksPerHost: {{ calico_ipam_maxblocksperhost }}
-- 
GitLab