-
Notifications
You must be signed in to change notification settings - Fork 102
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
dracut: add afterburn dracut module #224
Conversation
Also see discussion in: yuqi-zhang/afterburn-dracut#1 There is the question of whether we want this to run on the firstboot or all boots. I think the hybrid approach to conditionally track Azure's hostname iif no Ignition hostname is specified is possibly the most clean, but I'm not sure what the best way to detect that would be. |
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.
Looks sane to me
LGTM modulo the pending discussions around ordering & firstboot semantics. |
@jlebon has a good point, so I'm backtracking on my initial comment. Let's have the initramfs part first-boot only. |
I read around a bit and I think it mostly makes sense to keep this module as a firstboot initramfs hostname fetch. As for future boots/runtime hostname changes, I don't really foresee dhcp leased hostnames changes (and if we do, I think Azure handles it from what I can tell?), and static configurations are ignition based. As for ordering, the Please let me know if either of those two understandings sound incorrect. |
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.
Just one small comment, otherwise LGTM!
# Azure needs to fetch the hostname in the initramfs | ||
ConditionKernelCommandLine=|ignition.platform.id=azure | ||
ConditionFirstBoot=yes | ||
After=ignition-disks.service |
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.
@yuqi-zhang did you test this service unit on an actual Azure machine? Because I think I made a mistake and this should be After=ignition-mount.service
.
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.
I guess since it only writes to /sysroot/etc
, technically it just needs After=initrd-root-fs.target
. That'll work on both FCOS and RHCOS (which doesn't have ignition-mount.service
yet).
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.
I added After=initrd-root-fs.target
Wants=initrd-root-fs.target
based on https://github.com/coreos/ignition-dracut/blob/spec2x/dracut/30ignition/coreos-static-network.service
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.
Ack. And do we care about ignition-remount-sysroot.service
here? (I'm not so familiar with the new Ignition flow in initramfs)
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.
And do we care about
ignition-remount-sysroot.service
here?
It doesn't hurt, but shouldn't make a difference either, see: coreos/ignition-dracut#38 (comment).
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.
I suppose for safety we should? I'm also not sure on which systems that one actually runs.
And to your earlier point, I didn't test on Azure since I didn't have creds at the time, I made a mock unit with the same dependency tree to run on metal, and it worked as expected.
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.
Added
c4c4099
to
303ac6d
Compare
303ac6d
to
8ea0971
Compare
|
||
# This will be firstboot only to set up the correct | ||
# hostname for kube. | ||
ConditionFirstBoot=yes |
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.
One question, does this actually work correctly in the initrd? For the real root, systemd keys off of /etc/machine-id
, but here it has to be able to make that determination before /sysroot
is even mounted. So does it key off of the initrd's /etc/machine-id
? Except that check will never change result unless we regen the initrd.
An alternative here is to hook into ignition-complete.target
, which was made for this: https://github.com/coreos/ignition-dracut/blob/df88988f2f0791ca9ea1e14298c8523501d980c5/dracut/30ignition/ignition-complete.target#L3.
For RHCOS, since it doesn't have that target yet, you could do e.g. ignition-files.service.requires
?
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.
Afterburn does not depend on Ignition though, so we probably shouldn't make it use that target. I agree though that using ConditionFirstBoot
from the initramfs seems sketchy. Not sure the best path forward here. I think this is a case where the distro-dependence is showing.
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.
Afterburn does not depend on Ignition though, so we probably shouldn't make it use that target.
We explicitly reference ignition targets, I don't really see a harm in cross-linking per se? Unless you want them to be as separate as possible.
I did some testing with a metal-bios image. If I rd.break
into the initramfs on the first boot, I see the unit as inactive, and a message that: Condition: start condition failed
(and same with subsequent boots). Interesting if I try to systemctl start
the process manually, it will add a line CondtionFirstBoot=yes was not met
. I'm not sure if that's the expected behaviour or not (i.e. which condition is not being met).
In either case, this does not seem to be very robust... should we
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.
Afterburn does not depend on Ignition though, so we probably shouldn't make it use that target.
I'd say this unit is inherently dependent on Ignition already by simply having ConditionKernelCommandLine=|ignition.platform.id=azure
. :)
We could do something fancy here and "connect" the two in the overlay. Though unless there's demand for running Afterburn without Ignition, I'm not sure if it's worth the investment.
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.
I think this is fine now that I think about it. Part of me still just wants one giant fcos-dracut repo, but I think that ship has sailed.
8ea0971
to
ec8f0f7
Compare
Ok I've updated it to depend on ignition and tested it to work (firstboot only) For RHCOS I think we want to carry a patch to make it:
for now, since I don't really see a reason to branch. |
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.
Just some trivial nits, otherwise LGTM!
dracut/30afterburn/module-setup.sh
Outdated
"$systemdutildir/system/afterburn-hostname.service" | ||
|
||
# We want the afterburn-hostname to be firstboot only, so ignition-provided | ||
# hostname changes do not get overwritten on subsequentboots |
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.
Minor: subsequent boots
Super minor: Ignition
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.
Fixed up, thanks for the review!
Add dracut module to run afterburn in the initramfs, and add an initial service to fetch hostname on necessary providers (Azure). Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
ec8f0f7
to
e745830
Compare
@jlebon Should be good to go. I also opened https://src.fedoraproject.org/rpms/rust-afterburn/pull-request/1 to show how to pull it in once we release a new crate |
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.
Yup this LGTM!
I don't have merge access, will leave it to someone else to have a final look and merge.
Add dracut module to run afterburn in the initramfs, and add an
initial service to fetch hostname on necessary providers (Azure).