From 126765fd4247a840f8c9975bde93b2c4c4af3d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Mon, 22 Apr 2024 13:49:30 +0200 Subject: [PATCH] [v1.28] fix(hetzner): hostname label is not considered The Node Group info we currently return does not include the `kubernetes.io/hostname` label, which is usually set on every node. This causes issues when the user has an unscheduled pod with a `topologySpreadConstraint` on `topologyKey: kubernetes.io/hostname`. cluster-autoscaler is unable to fulfill this constraint and does not scale up any of the node groups. Related to #6715 --- .../cloudprovider/hetzner/hetzner_node_group.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go b/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go index 06aedd009129..a35067852da1 100644 --- a/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go +++ b/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go @@ -222,10 +222,14 @@ func (n *hetznerNodeGroup) TemplateNodeInfo() (*schedulerframework.NodeInfo, err return nil, fmt.Errorf("failed to create resource list for node group %s error: %v", n.id, err) } + nodeName := newNodeName(n) + node := apiv1.Node{ ObjectMeta: metav1.ObjectMeta{ - Name: newNodeName(n), - Labels: map[string]string{}, + Name: nodeName, + Labels: map[string]string{ + apiv1.LabelHostname: nodeName, + }, }, Status: apiv1.NodeStatus{ Capacity: resourceList,