Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't set the hostname #1171

Merged
merged 1 commit into from
Jan 31, 2024
Merged

Don't set the hostname #1171

merged 1 commit into from
Jan 31, 2024

Conversation

fgiudici
Copy link
Member

@fgiudici fgiudici commented Jan 19, 2024

If the (static) hostname is not set, we used to set a rancher-${RANDOM} one. This anyway prevents DHCP to serve a transient hostname. In Elemental, at registration time, the hostname is recorded as the MachineInventory name and from that point onwards it could not be changed. It will be enforced as the static hostname during the k3s/RKE2 provisioning.
Since we do registration just after the ISO boot, in order to use the DHCP provided hostname, we should allow the transient name to be set by the dhcp client (which happens only if the static hostname is not set) and then take advantage of the new templating value: ${System Data/Runtime/Hostname}
(see rancher/elemental-operator#593)

Let's anyway set the racher-${RANDOM} hostname but as a transient one and before the network stage (so it may be replaced by the DHCP provided one).

This is a change in behavior: on Elemental booting (before provisioning) if a hostname has not been set and DHCP provides one, the DHCP hostname takes precedence over the rancher-${RANDOM} one.

Fixes #1172

@fgiudici fgiudici requested a review from a team as a code owner January 19, 2024 15:16
@fgiudici fgiudici mentioned this pull request Jan 19, 2024
Copy link
Contributor

@frelon frelon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fgiudici
Copy link
Member Author

Patch changed: we keep creating the symlink and we set a transient hostname.

If the (static) hostname is not set, we used to set a rancher-${RANDOM}
one. This anyway prevents DHCP to serve a transient hostname.
In Elemental, at registration time, the hostname is recorded as the
MachineInventory name and from that point onwards it could not be
changed. It will be enforced as the static hostname during the k3s/RKE2
provisioning.
Since we do registration just after the ISO boot, in order to use the
DHCP provided hostname, we should allow the transient name to be set by
the dhcp client (which happens only if the static hostname is not
set) and then take advantage of the new templating value:
${System Data/Runtime/Hostname}
(see rancher/elemental-operator#593)

Let's anyway set the racher-${RANDOM} hostname but as a transient one
and before the network stage (so it may be replaced by the DHCP provided
one).

This is a change in behavior: on Elemental booting (before provisioning)
if a hostname has not been set and DHCP provides one, the DHCP hostname
takes precedence over the rancher-${RANDOM} one.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
@fgiudici fgiudici merged commit 0bf9ba8 into rancher:main Jan 31, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't set the hostname
2 participants