From fbcc8cc336aeddb83605824de3f304067c783106 Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Mon, 23 Sep 2024 16:09:07 +0200 Subject: [PATCH] control-plane: refactor group membership test Testing with group_names does not require the groups to exist. --- .../control-plane/templates/kubeadm-config.v1beta3.yaml.j2 | 2 +- .../templates/kubeadm-controlplane.v1beta3.yaml.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 b/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 index 9dd5e4376..e929a8436 100644 --- a/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 +++ b/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 @@ -16,7 +16,7 @@ nodeRegistration: {% if kube_override_hostname | default('') %} name: "{{ kube_override_hostname }}" {% endif %} -{% if inventory_hostname in groups['kube_control_plane'] and inventory_hostname not in groups['kube_node'] %} +{% if 'kube_control_plane' in group_names and 'kube_node' not in group_names %} taints: - effect: NoSchedule key: node-role.kubernetes.io/control-plane diff --git a/roles/kubernetes/control-plane/templates/kubeadm-controlplane.v1beta3.yaml.j2 b/roles/kubernetes/control-plane/templates/kubeadm-controlplane.v1beta3.yaml.j2 index bc9f3bdf9..59759188d 100644 --- a/roles/kubernetes/control-plane/templates/kubeadm-controlplane.v1beta3.yaml.j2 +++ b/roles/kubernetes/control-plane/templates/kubeadm-controlplane.v1beta3.yaml.j2 @@ -24,7 +24,7 @@ controlPlane: nodeRegistration: name: {{ kube_override_hostname | default(inventory_hostname) }} criSocket: {{ cri_socket }} -{% if inventory_hostname in groups['kube_control_plane'] and inventory_hostname not in groups['kube_node'] %} +{% if 'kube_control_plane' in group_names and 'kube_node' not in group_names %} taints: - effect: NoSchedule key: node-role.kubernetes.io/control-plane