-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[hetzner] cluster-autoscaler --nodes flag uses wrong format #18134
Description
Summary
When kops generates the cluster-autoscaler --nodes flag for Hetzner instance groups, it produces a 3-field format (min:max:name.cluster) that the Hetzner autoscaler cloud provider does not recognise. The autoscaler starts but no node groups are registered, so scale-out never happens.
Root cause
GetClusterAutoscalerNodeGroups() in upup/pkg/fi/cloudup/template_functions.go sets group.Other = ig.Name + "." + cluster.Name for all non-GCE cloud providers. This produces e.g.:
--nodes=1:5:nodes-hel1.k8s-test-135
The Hetzner autoscaler cloud provider (upstream code) parses the --nodes argument expecting 5 fields: min:max:instanceType:region:name. The instanceType and region fields are required for Hetzner to create correctly-typed servers in the correct location.
Expected format
--nodes=1:5:cpx32:hel1:nodes-hel1
For Hetzner, region is the Hetzner location name, which equals the subnet name stored in ig.Spec.Subnets[0].
Fix
Add a Hetzner branch in GetClusterAutoscalerNodeGroups():
} else if cluster.GetCloudProvider() == kops.CloudProviderHetzner {
region := ig.Spec.Subnets[0]
group.Other = fmt.Sprintf("%s:%s:%s", ig.Spec.MachineType, region, ig.Name)
}Fix included in the PR that accompanies this issue.