From d596f5d2b3c75b1b6e04fb485e19ce58b4d7faec Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com> Date: Sat, 5 Oct 2024 13:59:51 +0200 Subject: [PATCH] Ensure that k8s hostname is lowercased In case your hostname contains upper-level symbols, they will be all lowered in k8s cluster. With that it's important to ensure that the expected hostname used in roles is always lowercase one. Change-Id: I31e483cc7766e26f932984067daee6983122db10 --- .../playbooks/files/openstack_deploy/user_variables_k8s.yml | 2 +- mcapi_vexxhost/playbooks/mcapi_control_plane_k8s.yml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mcapi_vexxhost/playbooks/files/openstack_deploy/user_variables_k8s.yml b/mcapi_vexxhost/playbooks/files/openstack_deploy/user_variables_k8s.yml index e1610f50..2a3ebd3b 100644 --- a/mcapi_vexxhost/playbooks/files/openstack_deploy/user_variables_k8s.yml +++ b/mcapi_vexxhost/playbooks/files/openstack_deploy/user_variables_k8s.yml @@ -1,6 +1,6 @@ # wire OSA group, host and network addresses into k8s deployment kubernetes_control_plane_group: k8s_container -kubelet_hostname: "{{ ansible_facts['hostname'] }}" +kubelet_hostname: "{{ ansible_facts['hostname'] | lower }}" kubelet_node_ip: "{{ management_address }}" kubernetes_hostname: "{{ internal_lb_vip_address }}" kubernetes_non_init_namespace: true diff --git a/mcapi_vexxhost/playbooks/mcapi_control_plane_k8s.yml b/mcapi_vexxhost/playbooks/mcapi_control_plane_k8s.yml index 31bf867b..b6684a83 100644 --- a/mcapi_vexxhost/playbooks/mcapi_control_plane_k8s.yml +++ b/mcapi_vexxhost/playbooks/mcapi_control_plane_k8s.yml @@ -124,12 +124,13 @@ - role: "vexxhost.kubernetes.cilium" environment: "{{ deployment_environment_variables | default({}) }}" tasks: - - kubernetes.core.k8s: + - name: Ensure Nodes are defined and labeled + kubernetes.core.k8s: definition: apiVersion: v1 kind: Node metadata: - name: "{{ inventory_hostname }}" + name: "{{ inventory_hostname | lower }}" labels: "{{ k8s_node_labels }}" tags: - k8s