From eae5dd7b936667dd16b777c2a899cb8f26d2bfd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Tue, 27 Aug 2024 08:50:32 +0200 Subject: [PATCH] fix(hetzner): unused draining node pool references deprecated server type The `cx11` server type was deprecated on 2024-06-06 and will be removed from the API on 2024-09-06. Once it is removed, the cluster-autoscaler provider hetzner will not start anymore with the following error message: Failed to get node infos for groups: failed to create resource list for node group draining-node-pool error: failed to get machine type cx11 info error: server type not found As the node pool `draining-node-pool` is not being used anywhere, this commit removes it and the hard coded reference to the deprecated server type. --- .../hetzner/hetzner_cloud_provider.go | 1 - .../cloudprovider/hetzner/hetzner_manager.go | 15 --------------- .../cloudprovider/hetzner/hetzner_node_group.go | 4 ++-- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/cluster-autoscaler/cloudprovider/hetzner/hetzner_cloud_provider.go b/cluster-autoscaler/cloudprovider/hetzner/hetzner_cloud_provider.go index ad9e35d2e85e..046a8b456e81 100644 --- a/cluster-autoscaler/cloudprovider/hetzner/hetzner_cloud_provider.go +++ b/cluster-autoscaler/cloudprovider/hetzner/hetzner_cloud_provider.go @@ -41,7 +41,6 @@ const ( providerIDPrefix = "hcloud://" nodeGroupLabel = hcloudLabelNamespace + "/node-group" hcloudLabelNamespace = "hcloud" - drainingNodePoolId = "draining-node-pool" serverCreateTimeoutDefault = 5 * time.Minute serverRegisterTimeout = 10 * time.Minute defaultPodAmountsLimit = 110 diff --git a/cluster-autoscaler/cloudprovider/hetzner/hetzner_manager.go b/cluster-autoscaler/cloudprovider/hetzner/hetzner_manager.go index a4071b213792..fd4b4eea1b7d 100644 --- a/cluster-autoscaler/cloudprovider/hetzner/hetzner_manager.go +++ b/cluster-autoscaler/cloudprovider/hetzner/hetzner_manager.go @@ -206,16 +206,6 @@ func newManager() (*hetznerManager, error) { cachedServers: newServersCache(ctx, client), } - m.nodeGroups[drainingNodePoolId] = &hetznerNodeGroup{ - manager: m, - instanceType: "cx11", - region: "fsn1", - targetSize: 0, - maxSize: 0, - minSize: 0, - id: drainingNodePoolId, - } - return m, nil } @@ -252,11 +242,6 @@ func (m *hetznerManager) deleteServer(server *hcloud.Server) error { return err } -func (m *hetznerManager) addNodeToDrainingPool(node *apiv1.Node) (*hetznerNodeGroup, error) { - m.nodeGroups[drainingNodePoolId].targetSize += 1 - return m.nodeGroups[drainingNodePoolId], nil -} - func (m *hetznerManager) validProviderID(providerID string) bool { return strings.HasPrefix(providerID, providerIDPrefix) } diff --git a/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go b/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go index 4fe799dbb196..1740f87de208 100644 --- a/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go +++ b/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go @@ -287,7 +287,7 @@ func (n *hetznerNodeGroup) TemplateNodeInfo() (*schedulerframework.NodeInfo, err } node.Labels = cloudprovider.JoinStringMaps(node.Labels, nodeGroupLabels) - if n.manager.clusterConfig.IsUsingNewFormat && n.id != drainingNodePoolId { + if n.manager.clusterConfig.IsUsingNewFormat { for _, taint := range n.manager.clusterConfig.NodeConfigs[n.id].Taints { node.Spec.Taints = append(node.Spec.Taints, apiv1.Taint{ Key: taint.Key, @@ -391,7 +391,7 @@ func buildNodeGroupLabels(n *hetznerNodeGroup) (map[string]string, error) { nodeGroupLabel: n.id, } - if n.manager.clusterConfig.IsUsingNewFormat && n.id != drainingNodePoolId { + if n.manager.clusterConfig.IsUsingNewFormat { maps.Copy(labels, n.manager.clusterConfig.NodeConfigs[n.id].Labels) }