-
Notifications
You must be signed in to change notification settings - Fork 166
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
grub: de-hardcode firstboot network configuration #1373
Conversation
/hold |
See #1298 for the other spots we need to tweak too. Worth noting in the commit message also that the eventual goal is to remove |
we need to be real careful with this because it will change it for all streams. We need to make sure when we merge this and do our first testing release that we also tag coreos-assembler so we can use the same one for the subsequent stable release (this is related to https://github.com/coreos/fedora-coreos-streams/issues/64) |
Yeah, good point. Tagging cosa would work, though another approach is to just add a new |
There is a potential way to deal with N streams: embed the kargs into the That said, I don't have a strong opinion either way. The change seems sensible to me. |
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'm OK with this move but let's be careful to ensure all required updates make it into RHCOS as well here (IE: updated afterburn and the referenced service).
This is part of moving to conditional networking (coreos/fedora-coreos-tracker#443). Let's move the firstboot kargs here as prep for dropping them entirely. See also: coreos/coreos-assembler#1373
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.
Some comments, but LGTM overall! I've tested this as part of coreos/fedora-coreos-config#426.
|
||
# source in the `ignition.firstboot` file which could override the | ||
# above $ignition_network_kcmdline with static networking config. | ||
# This override feature is primarily used by coreos-installer to | ||
# persist static networking config provided during install to the | ||
# first boot of the machine. |
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.
Hmm, I think this comment is still true, no?
src/cmd-buildextend-metal
Outdated
@@ -143,6 +143,17 @@ if [ "${image_type}" = dasd ] || [ "${image_type}" = metal4k ]; then | |||
ignition_platform_id=metal | |||
fi | |||
|
|||
# Firstboot kernel arguments. | |||
firstboot_kargs="$(python3 -c ' | |||
import sys, yaml; |
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/optional: I think we can drop the semicolons here and below since this is a proper multiline string now?
import sys, yaml; | ||
LEGACY_DEFAULT = [ "rd.neednet=1", "ip=dhcp,dhcp6" ]; | ||
args = yaml.safe_load(sys.stdin).get("firstboot-kargs", LEGACY_DEFAULT); | ||
if not args: |
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 subtlety here that I missed at first (which contributed to why I originally wanted something more explicit than this) is that it appears like this can never be false since we provide a default. Maybe a comment here like: # firstboot-kargs provided, but is empty
?
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 blame PEP8 for convincing a generation of programmers that a list and a boolean are isomorphic)
This removes the hardcoded network configuration kargs from grub, moving them into handling within initramfs by `dracut-cmdline.service`.
Rebased. There was actually a bug in the logic writing This PR can land as soon review-stamped, as it internally preserve the previously-GRUB-hardcoded defaults. I manually tested that this works with the logic in Afterburn 4.4.0 in F32. |
/hold cancel |
Perfect 👍 /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ashcrow, jlebon, lucab The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -392,7 +395,7 @@ s390x) | |||
# stage on s390x, either through zipl->grub2-emu or zipl standalone. | |||
# See https://github.com/coreos/ignition-dracut/issues/84 | |||
# A similar hack is present in https://github.com/coreos/coreos-assembler/blob/master/src/gf-platformid#L55 | |||
echo "$(grep options $blsfile) ignition.firstboot rd.neednet=1 ip=dhcp,dhcp6" > $tmpfile |
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.
Hmm actually, I think we need to add ${firstboot_kargs}
here, right? Because s390x doesn't use the GRUB config yet. And in gf_platformid
too.
Or... we just sprint to coreos/fedora-coreos-config#426.
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.
This will also affect RHCOS and slower FCOS streams, so let's fix it.
I'm unsure however how to wire this new variable content to gf_platformid
. Do we actually need to have it there, if that is only injecting the platform ID?
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.
Meh, my current attempt is at #1479.
We've now reached the end of the conditional networking 🌈 rainbow 🌈. We can rip out the legacy default network firstboot kargs from cosa. These now live in the config repo. E.g.: https://github.com/coreos/fedora-coreos-config/blob/be456c437d4181435022ce47079b587f5bcb0319/overlay.d/05core/usr/lib/dracut/modules.d/15coreos-network/50-afterburn-network-kargs-default.conf For more details, see: coreos#1373 coreos/fedora-coreos-config#426
We've now reached the end of the conditional networking 🌈 rainbow 🌈. We can rip out the legacy default network firstboot kargs from cosa. These now live in the config repo. E.g.: https://github.com/coreos/fedora-coreos-config/blob/be456c437d4181435022ce47079b587f5bcb0319/overlay.d/05core/usr/lib/dracut/modules.d/15coreos-network/50-afterburn-network-kargs-default.conf For more details, see: #1373 coreos/fedora-coreos-config#426
This removes the hardcoded network configuration kargs from grub,
moving them into handling within initramfs by
dracut-cmdline.service
.Ref: coreos/fedora-coreos-tracker#460
Ref: coreos/fedora-coreos-config#427