Skip to content

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

Open
benedikt-haug wants to merge 1 commit into
gardener:masterfrom
benedikt-haug:fix/set-explicit-hostname
Open

benedikt-haug wants to merge 1 commit into
gardener:masterfrom
benedikt-haug:fix/set-explicit-hostname

Conversation

@benedikt-haug

Copy link
Copy Markdown

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: Pin the Nova compute client to microversion 2.90, enabling the hostname field in server create/update requests.

  2. pkg/driver/executor/executor.go: Pass machineName as the explicit hostname in servers.CreateOpts, decoupling the OS hostname from the display name.

Effects

Aspect Before After
Nova display name shoot--...-2t9lq unchanged
OS hostname in VM shoot--...-2t9lq.novalocal (potentially >63 bytes) shoot--...-2t9lq (≤63 bytes)
kubernetes.io/hostname label may exceed 63-byte limit stays within limit
Hostname stability across reboots unstable (race condition, see #569) stable (short name from metadata)
Normal VMs (no hostname field) .novalocal appended unchanged

Compatibility

  • Requires Nova ≥ Wallaby (microversion 2.90). Older deployments will reject the microversion negotiation.
  • hostname validation by Nova: ≤63 chars, alphanumeric + dashes only, no trailing dash. Gardener machine names comply by construction (RFC 1123).
  • Existing nodes keep their old hostname; only new VMs are affected.

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.

…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).
@benedikt-haug
benedikt-haug requested review from a team as code owners September 9, 2026 14:54
@gardener-prow gardener-prow Bot added the do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. label Sep 9, 2026
@gardener-prow

gardener-prow Bot commented Sep 9, 2026

Copy link
Copy Markdown

Welcome @benedikt-haug!

It looks like this is your first PR to gardener/machine-controller-manager-provider-openstack 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if gardener/machine-controller-manager-provider-openstack has its own contribution guidelines.

Thank you, and welcome to Gardener. 😃

@gardener-prow

gardener-prow Bot commented Sep 9, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign thiyyakat for approval. For more information see the Code Review Process.

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

Details Needs approval from an approver in each of these files:

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 added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 9, 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/XS Denotes a PR that changes 0-9 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

1 participant