Skip to content

fix: conditionally set explicit hostname in Nova server create to prevent .novalocal suffix - #426

Merged
gardener-prow[bot] merged 1 commit into
gardener:masterfrom
benedikt-haug:fix/set-explicit-hostname
Oct 9, 2026
Merged

gardener-prow[bot] merged 1 commit into
gardener:masterfrom
benedikt-haug:fix/set-explicit-hostname

Conversation

@benedikt-haug

Copy link
Copy Markdown
Contributor

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 the kubernetes.io/hostname node label, causing pod scheduling failures:

unable to parse requirement: values[0][kubernetes.io/hostname]:
Invalid value: "shoot--staging--kbo8cp525p-worker-ndrej-z3-58f8b-2t9lq.novalocal":
must be no more than 63 bytes

Additionally, the .novalocal suffix causes hostname instability across reboots (see gardener/gardener-extension-provider-openstack#569): cloud-init re-applies the FQDN on reboot, racing with the ExecStartPre workaround that strips the domain, leading to inconsistent hostnames and kubelet startup failures.

Background

Since Nova Wallaby (API microversion 2.90), the hostname field in POST /servers allows decoupling the OS hostname from the display name. When set, Nova uses this value directly in the metadata service — without appending dhcp_domain. The display name (Name) remains unaffected.

This was confirmed via a manual PoC against an OpenStack deployment (Nova max microversion 2.100):

  • hostname field accepted with MV 2.90
  • OS-EXT-SRV-ATTR:hostname stored the explicit value without .novalocal
  • Normal VMs (without hostname field) remained unaffected

References:

Changes

  1. pkg/client/nova.go: Conditionally pin the Nova compute client to microversion 2.90 using utils.GetSupportedMicroversions(), enabling the hostname field in server create requests. Falls back gracefully on older Nova deployments.

  2. pkg/driver/executor/executor.go: Pass machineName as the explicit hostname in servers.CreateOpts only when SupportsHostnameOverride() returns true, decoupling the OS hostname from the display name.

  3. pkg/client/types.go: Added SupportsHostnameOverride() bool to the Compute interface.

Supersedes #414 (closed due to accidental force-push). Incorporates all review feedback from @aaronfern and @AndreasBurger.

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.

@benedikt-haug
benedikt-haug requested review from a team as code owners October 8, 2026 15:25
@gardener-prow gardener-prow Bot added do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 8, 2026
@federated-github-access

Copy link
Copy Markdown
Contributor

The PR needs to be labeled with ok-to-test by a maintainer to trigger the automated validation of the change

@AndreasBurger AndreasBurger added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Oct 9, 2026
@federated-github-access federated-github-access Bot removed the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Oct 9, 2026
@AndreasBurger

Copy link
Copy Markdown
Member

/lgtm, thanks. Can you sign the commit as required by the DCO-check?

…vent .novalocal suffix

Signed-off-by: Benedikt Haug <benedikt.haug@gmx.de>
@benedikt-haug
benedikt-haug force-pushed the fix/set-explicit-hostname branch from 099800a to 754c77d Compare October 9, 2026 08:41
@federated-github-access

Copy link
Copy Markdown
Contributor

The PR needs to be labeled with ok-to-test by a maintainer to trigger the automated validation of the change

@benedikt-haug

Copy link
Copy Markdown
Contributor Author

/lgtm, thanks. Can you sign the commit as required by the DCO-check?

done

@aaronfern

Copy link
Copy Markdown
Member

Thanks for the PR @benedikt-haug!
/lgtm
/approve

@gardener-prow gardener-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Oct 9, 2026
@gardener-prow

gardener-prow Bot commented Oct 9, 2026

Copy link
Copy Markdown

LGTM label has been added.

DetailsGit tree hash: cb2cb294397a42c9beb01495a51399e236cea40e

@gardener-prow gardener-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 9, 2026
@aaronfern

Copy link
Copy Markdown
Member

/kind enhancement

@gardener-prow gardener-prow Bot added kind/enhancement Enhancement, improvement, extension and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Oct 9, 2026
@aaronfern aaronfern added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Oct 9, 2026
@federated-github-access federated-github-access Bot removed the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Oct 9, 2026
@gardener-prow

gardener-prow Bot commented Oct 9, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aaronfern, AndreasBurger

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [AndreasBurger,aaronfern]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow
gardener-prow Bot merged commit 302d6d1 into gardener:master Oct 9, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/enhancement Enhancement, improvement, extension lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shoot worker node hostname changes after machine reboot

3 participants