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
This commit is contained in:
Dmitriy Rabotyagov 2024-10-05 13:59:51 +02:00
parent 66c4f75967
commit d596f5d2b3
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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