-
Notifications
You must be signed in to change notification settings - Fork 32
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
Hostname gets reset in Azure VM with alpha 3794.0.0 #1262
Comments
Here's the full log: Relevant part:
|
On stable oem-cloudinit.serivce says this:
whereas on alpha:
|
Stable coreos-cloudinit (commit b50fb65) does this: -func Apply(cfg config.CloudConfig, ifaces []network.InterfaceGenerator, env *Environment) error {
- if cfg.Hostname != "" {
- if err := system.SetHostname(cfg.Hostname); err != nil {
- return err
- }
- log.Printf("Set hostname to %s", cfg.Hostname)
- }
- Alpha cloudinit (commit 47bc4cf) does: +func ApplyHostname(hostname string) error {
+ if err := system.SetHostname(hostname); err != nil {
+ return fmt.Errorf("error setting hostname: %w", err)
+ }
+ log.Printf("Set hostname to %s", hostname)
+ return nil
+}
+ |
@gabriel-samfira would you be able to take a look at this? |
This is a critical bug for us, as in our environment this issue prevents new nodes from joining the cluster as their hostname has been reset to "localhost". Since flatcar/coreos-cloudinit#21 this results in resetting the hostname to "localhost". |
@MichaelEischer sorry about dropping the ball on this. This will be fixed asap |
The refactoring in flatcar#21 caused hostnames to be set unconditionally compared to the old behavior of only setting the hostname if it not empty. When running coreos-cloudinit with datasources that do not provide metadata such as the `file` datasource, the refactored code caused the hostname to always be reset to `localhost`. This leads to various problems like preventing k8s nodes from joining their cluster. This change restores the old behavior by not applying empty hostnames. Fixes flatcar/Flatcar#1262
I've opened flatcar/coreos-cloudinit#25 |
Merged to main and cherry-picked to 3760 and 3815 branches. This will soon be coming to affected channels. |
Thanks! |
Thank you for contributing the code @MichaelEischer |
Description
Azure VMs deployed from alpha 3794.0.0 end up with a configured hostname of 'localhost' when deployed with the default params (no user provided ignition file). It appears to be connected with the update to waagent 2.9.1.1, and the hostname is set to localhost by
oem-cloudinit.service
.Impact
Probably breaks all sorts of things. Surprising that kola doesn't catch this (is ignition used in all tests?).
Environment and steps to reproduce
az vm create -n flatcar-vm-2 -g $g -size Standard_E8bds_v5 --image kinvolk:flatcar-container-linux-free:alpha-gen2:latest --admin-username azureuser --disk-controller-type nvme --security-type standard
ssh <ip> hostname
localhost
Expected behavior
VM hostname should be the same as instance id (here flatcar-vm-2).
Additional information
Please add any information here that does not fit the above format.
The text was updated successfully, but these errors were encountered: