baremetal: sets hostname controller_names/worker_names
Sets the hostname from the `<cluster_name>-worker-<count_index>` which
is set when `set_standard_hostname` is true, to
`controller_names<count_index>` for controllers and
`worker_names<count_index>` for workers
The hostname change got introduced by where it was set from the
template variable `domain_name` coming from
var.controller_domains[count.index]
MODIFY
assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/controller.tf
assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/controller.tf
@@ -10,6 +10,17 @@ module "controller" {
apiserver = format("%s.%s", var.cluster_name, var.k8s_domain_name)
ca_cert = module.bootkube.ca_cert
kubelet_labels = lookup(var.node_specific_labels, var.controller_names[count.index], {})
- clc_snippets = lookup(var.clc_snippets, var.controller_names[count.index], [])
- set_standard_hostname = true
+ set_standard_hostname = false
+ clc_snippets = concat(lookup(var.clc_snippets, var.controller_names[count.index], []), [
+ <<EOF
+storage:
+ files:
+ - path: /etc/hostname
+ filesystem: root
+ mode: 0644
+ contents:
+ inline: ${var.controller_names[count.index]}
+EOF
+ ,
+ ])
}

MODIFY
assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/worker.tf
assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/worker.tf
@@ -9,7 +9,18 @@ module "worker" {
apiserver = format("%s.%s", var.cluster_name, var.k8s_domain_name)
kubelet_labels = merge(lookup(var.node_specific_labels, var.worker_names[count.index], {}), var.labels)
cluster_name = var.cluster_name
- clc_snippets = lookup(var.clc_snippets, var.worker_names[count.index], [])
- set_standard_hostname = true
+ set_standard_hostname = false
+ clc_snippets = concat(lookup(var.clc_snippets, var.worker_names[count.index], []), [
+ <<EOF
+storage:
+ files:
+ - path: /etc/hostname
+ filesystem: root
+ mode: 0644
+ contents:
+ inline: ${var.worker_names[count.index]}
+EOF
+ ,
+ ])
}

baremetal: sets hostname controller_names/worker_names

Sets the hostname from the `<cluster_name>-worker-<count_index>` which
is set when `set_standard_hostname` is true, to
`controller_names<count_index>` for controllers and
`worker_names<count_index>` for workers

The hostname change got introduced by #1477 where it was set from the
template variable `domain_name` coming from
var.controller_domains[count.index]