Skip to content

Commit

Permalink
[v1.28] fix(hetzner): hostname label is not considered
Browse files Browse the repository at this point in the history
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 kubernetes#6715
  • Loading branch information
apricote committed Apr 24, 2024
1 parent a1e57b7 commit e06f2af
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package hetzner
import (
"context"
"fmt"
"maps"
"math/rand"
"strings"
"sync"
Expand Down Expand Up @@ -222,10 +223,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,
Expand Down

0 comments on commit e06f2af

Please sign in to comment.