From 92e8ac9de236e9d3a3c29d2229722798f0e5fa2c Mon Sep 17 00:00:00 2001
From: Max Gautier <mg@max.gautier.name>
Date: Thu, 22 May 2025 08:20:36 +0000
Subject: [PATCH] Remove tag 'master' (#12228)

* Remove tag master

Following it's deprecation in 4b324cb0f (Rename master to control plane
- non-breaking changes only (#11394), 2024-09-06)

* Add fail fast path when using removed tags

- Used for the master tag, but this could be used for other things in
  the future
---
 docs/ansible/ansible.md                            |  1 -
 playbooks/cluster.yml                              |  4 ++--
 roles/etcd/tasks/main.yml                          |  2 --
 .../preinstall/tasks/0050-create_directories.yml   |  2 --
 roles/validate_inventory/tasks/main.yml            | 14 +++++++++++++-
 5 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/docs/ansible/ansible.md b/docs/ansible/ansible.md
index f0c73f254..a21de529e 100644
--- a/docs/ansible/ansible.md
+++ b/docs/ansible/ansible.md
@@ -118,7 +118,6 @@ The following tags are defined in playbooks:
 | local-path-provisioner         | Configure External provisioner: local-path            |
 | local-volume-provisioner       | Configure External provisioner: local-volume          |
 | macvlan                        | Network plugin macvlan                                |
-| master (DEPRECATED)            | Deprecated - see `control-plane`                      |
 | metallb                        | Installing and configuring metallb                    |
 | metrics_server                 | Configuring metrics_server                            |
 | netchecker                     | Installing netchecker K8s app                         |
diff --git a/playbooks/cluster.yml b/playbooks/cluster.yml
index bf9bc98f8..85829ca44 100644
--- a/playbooks/cluster.yml
+++ b/playbooks/cluster.yml
@@ -38,7 +38,7 @@
   environment: "{{ proxy_disable_env }}"
   roles:
     - { role: kubespray_defaults }
-    - { role: kubernetes/control-plane, tags: master }
+    - { role: kubernetes/control-plane, tags: control-plane }
     - { role: kubernetes/client, tags: client }
     - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
 
@@ -75,7 +75,7 @@
   environment: "{{ proxy_disable_env }}"
   roles:
     - { role: kubespray_defaults }
-    - { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"] }
+    - { role: win_nodes/kubernetes_patch, tags: ["control-plane", "win_nodes"] }
 
 - name: Install Kubernetes apps
   hosts: kube_control_plane
diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml
index 7e8c0f108..543eefb3c 100644
--- a/roles/etcd/tasks/main.yml
+++ b/roles/etcd/tasks/main.yml
@@ -39,7 +39,6 @@
     - kube_network_plugin != "calico" or calico_datastore == "etcd"
     - ('k8s_cluster' in group_names)
   tags:
-    - master    # master tag is deprecated and replaced by control-plane
     - control-plane
     - network
 
@@ -51,7 +50,6 @@
     - kube_network_plugin != "calico" or calico_datastore == "etcd"
     - ('k8s_cluster' in group_names)
   tags:
-    - master    # master tag is deprecated and replaced by control-plane
     - control-plane
     - network
 
diff --git a/roles/kubernetes/preinstall/tasks/0050-create_directories.yml b/roles/kubernetes/preinstall/tasks/0050-create_directories.yml
index 0ce1758a8..fbbe06488 100644
--- a/roles/kubernetes/preinstall/tasks/0050-create_directories.yml
+++ b/roles/kubernetes/preinstall/tasks/0050-create_directories.yml
@@ -14,7 +14,6 @@
     - bootstrap_os
     - apps
     - network
-    - master    # master tag is deprecated and replaced by control-plane
     - control-plane
     - node
   with_items:
@@ -38,7 +37,6 @@
     - bootstrap_os
     - apps
     - network
-    - master    # master tag is deprecated and replaced by control-plane
     - control-plane
     - node
   with_items:
diff --git a/roles/validate_inventory/tasks/main.yml b/roles/validate_inventory/tasks/main.yml
index 3d6c2cb63..9fedd2faa 100644
--- a/roles/validate_inventory/tasks/main.yml
+++ b/roles/validate_inventory/tasks/main.yml
@@ -1,7 +1,19 @@
 ---
-# This should only contains check of the inventory itself, nothing depending on facts
+# This should only contains check of:
+# - the inventory
+# - extra variables
+# - ansible commandline
+# -> nothing depending on facts or similar cluster state
 # Checks depending on current state (of the nodes or the cluster)
 # should be in roles/kubernetes/preinstall/tasks/0040-verify-settings.yml
+- name: Stop if removed tags are used
+  assert:
+    msg: The tag 'master' is removed. Use 'control-plane' instead
+    that:
+      - ('master' not in ansible_run_tags)
+      - ('master' not in ansible_skip_tags)
+        # TODO: Remove checks after next release
+
 - name: Stop if kube_control_plane group is empty
   assert:
     that: groups.get( 'kube_control_plane' )
-- 
GitLab