Skip to content

Commit

Permalink
fix(hetzner): unused draining node pool references deprecated server …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
apricote committed Aug 27, 2024
1 parent 9226cf6 commit eae5dd7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 0 additions & 15 deletions cluster-autoscaler/cloudprovider/hetzner/hetzner_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit eae5dd7

Please sign in to comment.