fix: set explicit hostname in Nova server create to prevent .novalocal suffix - #414
benedikt-haug wants to merge 1 commit into
Conversation
…l suffix Pin Nova compute client to microversion 2.90 and pass machineName as the explicit hostname in servers.CreateOpts. This decouples the OS hostname from the display name, preventing Nova from appending dhcp_domain (e.g. .novalocal) which can exceed the 63-byte RFC 1123 label limit enforced by Kubernetes for the kubernetes.io/hostname node label. Also fixes hostname instability across reboots caused by cloud-init re-applying the FQDN suffix (gardener/gardener-extension-provider-openstack#569).
|
Welcome @benedikt-haug! |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
The PR needs to be labeled with ok-to-test by a maintainer to trigger the automated validation of the change |
Motivation
When Nova derives the OS hostname from the server display name, it appends the
[api] dhcp_domain(commonly.novalocal). For Gardener shoot workers, the full machine name can exceed the 63-byte RFC 1123 label limit that Kubernetes enforces for thekubernetes.io/hostnamenode label, causing pod scheduling failures:Additionally, the
.novalocalsuffix causes hostname instability across reboots (see gardener/gardener-extension-provider-openstack#569): cloud-init re-applies the FQDN on reboot, racing with theExecStartPreworkaround that strips the domain, leading to inconsistent hostnames and kubelet startup failures.Background
Since Nova Wallaby (API microversion 2.90), the
hostnamefield inPOST /serversallows decoupling the OS hostname from the display name. When set, Nova uses this value directly in the metadata service — without appendingdhcp_domain. The display name (Name) remains unaffected.This was confirmed via a manual PoC against an OpenStack deployment (Nova max microversion 2.100):
hostnamefield accepted with MV 2.90OS-EXT-SRV-ATTR:hostnamestored the explicit value without.novalocalhostnamefield) remained unaffectedReferences:
CreateOpts.Hostnamefield (available since v2.x, confirmed in v2.12.0)Changes
pkg/client/nova.go: Pin the Nova compute client to microversion 2.90, enabling thehostnamefield in server create/update requests.pkg/driver/executor/executor.go: PassmachineNameas the explicithostnameinservers.CreateOpts, decoupling the OS hostname from the display name.Effects
shoot--...-2t9lqshoot--...-2t9lq.novalocal(potentially >63 bytes)shoot--...-2t9lq(≤63 bytes)kubernetes.io/hostnamelabelhostnamefield).novalocalappendedCompatibility
hostnamevalidation by Nova: ≤63 chars, alphanumeric + dashes only, no trailing dash. Gardener machine names comply by construction (RFC 1123).Fixes gardener/gardener-extension-provider-openstack#569
🤖 Generated with AI assistance — the code changes, analysis, and PoC verification were performed by an AI agent. The approach was validated manually against a live OpenStack deployment.