Repository navigation
fix: conditionally set explicit hostname in Nova server create to prevent .novalocal suffix - #414
benedikt-haug wants to merge 1 commit into
Conversation
|
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 |
|
Thanks for the PR @benedikt-haug! The only reservation I have is that this will now fail with any openstack deployment that does not have the |
659a9c6 to
242f34f
Compare
|
@aaronfern |
|
The PR needs to be labeled with ok-to-test by a maintainer to trigger the automated validation of the change |
1 similar comment
|
The PR needs to be labeled with ok-to-test by a maintainer to trigger the automated validation of the change |
242f34f to
b031f9f
Compare
|
The PR needs to be labeled with ok-to-test by a maintainer to trigger the automated validation of the change |
|
@aaronfern Thanks for the review! |
aaronfern
left a comment
There was a problem hiding this comment.
One last comment. Otherwise looks good to me
| Expect(server.InternalIPs).To(ConsistOf(serverIPv4, serverIPv6)) | ||
| }) | ||
|
|
||
| It("should not set hostname when SupportsHostnameOverride returns false", func() { |
There was a problem hiding this comment.
Could this be renamed to be more accurate?
| It("should not set hostname when SupportsHostnameOverride returns false", func() { | |
| It("should succeed | |
| when SupportsHostnameOverride returns false", func() { |
|
@benedikt-haug, It also looks like the |
| // create requests is honoured by Nova. Without this, Nova derives | ||
| // the hostname from the display name and appends [api] dhcp_domain | ||
| // (e.g. ".novalocal"), which can push the OS hostname beyond the | ||
| // 63-byte RFC 1123 label limit enforced by Kubernetes for the | ||
| // kubernetes.io/hostname node label. | ||
| // Fall back gracefully if the Nova deployment does not support 2.90. | ||
| supported, err := utils.GetSupportedMicroversions(ctx, compute) | ||
| if err != nil { | ||
| klog.Warningf("failed to determine Nova microversion support: %v", err) | ||
| } else if ok, err := supported.IsSupported("2.90"); err != nil { | ||
| klog.Warningf("failed to check Nova microversion 2.90 support: %v", err) | ||
| } else if ok { | ||
| compute.Microversion = "2.90" | ||
| } |
There was a problem hiding this comment.
There is a function in the SDK, utils.RequireMicroversion() that does something very similar.
I suspect that it won't be much cleaner to use it, so I'll leave it up to you. Once @aaronfern's remarks are addressed lgtm
…vent .novalocal suffix Instead of hard-pinning microversion 2.90 unconditionally, use utils.GetSupportedMicroversions to check at runtime whether the Nova deployment supports 2.90+. Only then set the hostname field in server create requests. Fall back gracefully to the previous behavior on older Nova deployments that don't support 2.90.
b031f9f to
5cc97a1
Compare
|
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.