Skip to content

grub: de-hardcode firstboot network configuration - #1373

Merged
openshift-merge-robot merged 1 commit into
coreos:masterfrom
lucab:ups/grub-ipless
May 26, 2020
Merged

openshift-merge-robot merged 1 commit into
coreos:masterfrom
lucab:ups/grub-ipless

Conversation

@lucab

@lucab lucab commented Apr 20, 2020 •

Copy link
Copy Markdown
Contributor

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

@lucab

lucab commented Apr 20, 2020

Copy link
Copy Markdown
Contributor Author

/hold

@jlebon

jlebon commented Apr 20, 2020

Copy link
Copy Markdown
Member

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 rd.neednet=1 as well as we move towards on-request network enablement.

@dustymabe

Copy link
Copy Markdown
Member

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)

@jlebon

jlebon commented Apr 21, 2020

Copy link
Copy Markdown
Member

we need to be real careful with this because it will change it for all streams

Yeah, good point. Tagging cosa would work, though another approach is to just add a new image.yaml knob which cosa keys off of. That way it naturally gets promoted together with content. I think we should do that anyway so that it's easier to ratchet all of this into FCOS/RHCOS atomically.

@darkmuggle

Copy link
Copy Markdown
Contributor

There is a potential way to deal with N streams: embed the kargs into the ignition.firstboot and have grub read them in and then set the defaults on a per distro/stream. The advantage here is decoupling the builder from the configuration. I also think we could take it further, and just have the grub.cfg provided by the stream itself and COSA place it.

That said, I don't have a strong opinion either way. The change seems sensible to me.

@ashcrow ashcrow left a comment

Copy link
Copy Markdown
Contributor

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).

@lucab
lucab force-pushed the ups/grub-ipless branch from a4a0c0e to a8d334f Compare May 25, 2020 15:11
Comment thread src/cmd-buildextend-metal Resolved
@lucab
lucab force-pushed the ups/grub-ipless branch from a8d334f to 0401cb5 Compare May 25, 2020 15:54
jlebon added a commit to jlebon/fedora-coreos-config that referenced this pull request May 25, 2020
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

@jlebon jlebon left a comment

Copy link
Copy Markdown
Member

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.

Comment thread src/grub.cfg
# 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.

Copy link
Copy Markdown
Member

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?

Comment thread src/cmd-buildextend-metal Outdated

# Firstboot kernel arguments.
firstboot_kargs="$(python3 -c '
import sys, yaml;

Copy link
Copy Markdown
Member

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?

Comment thread src/cmd-buildextend-metal
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:

Copy link
Copy Markdown
Member

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 ?

@lucab lucab May 26, 2020 •

Copy link
Copy Markdown
Contributor Author

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`.
@lucab

lucab commented May 26, 2020 •

Copy link
Copy Markdown
Contributor Author

Rebased. There was actually a bug in the logic writing /boot/ignition.firstboot. I also adjusted the parameter name to match what GRUB and coreos-installer use.
coreos/fedora-coreos-config#427 shows how to configure this logic.

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.

@lucab

lucab commented May 26, 2020

Copy link
Copy Markdown
Contributor Author

/hold cancel

@ashcrow

ashcrow commented May 26, 2020

Copy link
Copy Markdown
Contributor

This PR can land as soon review-stamped, as it internally preserve the previously-GRUB-hardcoded defaults.

Perfect 👍

/lgtm

@openshift-ci-robot

Copy link
Copy Markdown

[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

Details Needs approval from an approver in each of these files:
  • OWNERS [ashcrow,jlebon,lucab]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot
openshift-merge-robot merged commit 5f2e11e into coreos:master May 26, 2020
Comment thread src/create_disk.sh
# 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

Copy link
Copy Markdown
Member

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.

@lucab lucab May 26, 2020 •

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Contributor Author

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.

@lucab
lucab deleted the ups/grub-ipless branch May 26, 2020 13:46
jlebon added a commit to jlebon/coreos-assembler that referenced this pull request Aug 21, 2020
openshift-merge-robot pushed a commit that referenced this pull request Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants