-
Notifications
You must be signed in to change notification settings - Fork 106
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
kubevirt: Run afterburn-hostname service #1005
kubevirt: Run afterburn-hostname service #1005
Conversation
Can you also update the docs? |
Looks like everything was added in #725 |
Won't this override the hostname if DHCP did provide it? Are they always guaranteed to be the same? If not, should the one in the metadata win? |
Have to verify it, but my idea is that afterburn comes before ignition, so if ignition goes after and activate network interfaces DHCP will override the hostname. |
As is, with this PR the hostname from |
Will post results here, I think we have something at ignition that triggers DHCP again. |
You right, after attaching a dnsmasq to the interface with special hostname I see it's serving it
But hostnamectl shows that we have the old name
|
@jlebon maybe for kubevirt we can set the "transient" hostname so it can be overriden by DHCP |
I have test the following
And it works as expected and the hostname is set if no DHCP hostname is received but overriden if DHCP hostname option is arrives. But I don't know how to make this conditional to kubevirt. We can see hostname is transient
UPDATE: An option would be to create a new |
I kind of think this should be the behavior. What is the behavior on other platforms? DHCP can be unreliable, i.e. if there are multiple networks and all of them provide a hostname via DHCP, which one wins? I think the way NM works today is to choose the one with the default route, but if the hostname is set in the metadata for an instance I think we should just use that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As is, with this PR the hostname from
afterburn-hostname.service
will take precedence over the DHCP-provided one. That may be the right thing to do, but I just want to make sure in case that wasn't considered.I kind of think this should be the behavior. What is the behavior on other platforms?
I'm not sure if any of the other providers in that unit would allow you to customize DHCP to that extent. But if any did, the metadata would clearly win since the unit would run. There are some providers that do provide metadata for the hostname that are not listed in the unit however: PowerVS, OpenStack, and Packet. I'm not sure if their omission from the unit is an oversight or on purpose.
DHCP can be unreliable, i.e. if there are multiple networks and all of them provide a hostname via DHCP, which one wins? I think the way NM works today is to choose the one with the default route, but if the hostname is set in the metadata for an instance I think we should just use that.
That sounds reasonable to me. My intuition is also that the metadata should win, but what made me hesitate is that because we shipped KubeVirt support without this from day 1, the status quo currently is that we're relying on DHCP hostnames. So this can be a noticeable behaviour change to users currently relying on the node defaulting to the DHCP hostname (if it differs from the metadata). And maybe that's OK but it's worth flagging.
@qinqon Can you add a release note item for this?
@@ -13,6 +13,7 @@ ConditionKernelCommandLine=|ignition.platform.id=hetzner | |||
ConditionKernelCommandLine=|ignition.platform.id=ibmcloud | |||
ConditionKernelCommandLine=|ignition.platform.id=scaleway | |||
ConditionKernelCommandLine=|ignition.platform.id=vultr | |||
ConditionKernelCommandLine=|ignition.platform.id=kubevirt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the list is in alphabetical order. Can you insert it in the right spot?
I think there are not much users of the fcos/rhcos kubevirt provider, up until recently we were using openstack provider since kubevirt provide didn't exist there, so I doubt we would break a lot of installations if we change the status quos here. Also if we honor the hostname metadata and we add knob at kubevirt so is not set on creation per VM then we can keep the old behaviour, we have to check with cloud-init too, since KubeVirt supports that.
Sure. |
e7470fb
to
68ab211
Compare
Have check what cloud-init is doing for rhel related to hostname metadata value and looks like they have an extra knob to make it static or transient if it's handled by systemd and we can use hostnamectl Maybe we can do similar at afterburn and read this extra knob. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, good to know breakage isn't much of a concern.
Have check what cloud-init is doing for rhel related to hostname metadata value and looks like they have an extra knob to make it static or transient if it's handled by systemd and we can use hostnamectl
number5/cloud-init@
76972b4
/cloudinit/distros/rhel.py#L110-L123Maybe we can do similar at afterburn and read this extra knob.
This is configured via a cloud-init config file I suppose? I don't think we want to have a dep on that here. And of course, it won't be configurable via Ignition since we run before those files are written. :) But also, currently afterburn-hostname.service
runs just on first boot and transient hostnames don't survive a reboot.
I'm also unsure if there's a legitimate use case for doing this. Note that the hostname can always be overridden via Ignition. And having consistency cross-platform is valuable.
Let's stick with this and we can always tweak things in the future if a compelling use case shows up.
LGTM overall, just one tweak!
@jlebon Can we put this on holdm ? We are going to discuss about it today at team's sync. Maybe we prefer different approach at MCO openshift/machine-config-operator#4005 Looks like there are other providers that has similar stuff under MCO |
/hold |
Ahh right, we can create the persistent hostname and then at ignition convert it to transient before NetworkManager, but at least we have a hostname set. |
We need to make sure we don't break HyperShift + KubeVirt before merging this (see discussions in openshift/machine-config-operator#4005). |
/hold cancel @jlebon @dustymabe all good from hypershift to merge this and go with the solution we talk about |
The KubeVirt platform is already supported by afterburn to set the hostname, also there is an official fedora coreos container disk to run it. This change include it in the list of platforms allowed to run afterburn hostname feature at startup. Signed-off-by: Enrique Llorente <[email protected]>
e16fcb1
to
8783c39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The KubeVirt platform is already supported by afterburn to set the hostname, also there is an official fedora coreos container disk to run it. This change include it in the list of platforms allowed to run afterburn hostname feature at startup.
Close https://issues.redhat.com/browse/OCPBUGS-22259