Skip to content

Support disabling initramfs networking via Ignition #979

Closed

Description

@stbenjam

Feature Request

Support running part of ignition before networking comes up

Environment

RHCOS

What hardware/cloud provider/hypervisor is being used to run Ignition?

Baremetal

Desired Feature

For baremetal IPI platform in OpenShift, we load ignition from disk. We would like to include network configuration that happens before NetworkManager starts. For example, we want to disable dhcp on some interfaces. If we can't do that, then on some hosts that could have upwards of 10 (!) interfaces, booting takes an extraordinary long time.

Also, when an ignition contains an 'append' with a network source, it's conceivable we need to do some pre-configuration to make that network endpoint accessible (for example, we need to configure a VLAN on an interface).

Other Information

It's almost like we need a pre-ignition tool (preflight?) analogous to what afterburn is doing post-ignition.

Activity

  1. stbenjam commented on May 14, 2020

    @stbenjam
    Author

    @cgwalters What do you think of something like this?

  2. hardys commented on May 14, 2020

    @hardys

    To link this to a real (OpenShift) use-case, see https://bugzilla.redhat.com/show_bug.cgi?id=1824331 - in some baremetal environments the external network can be on a tagged vlan, so you have to do some configuration via ignition before the append (in v2.x) URL can be evaluated. I guess a similar issue exists with the merge feature in v3.

  3. cgwalters commented on May 14, 2020

    @cgwalters
    Member

    A lot of overlap here with openshift/enhancements#291

  4. stbenjam commented on May 14, 2020

    @stbenjam
    Author

    A lot of overlap here with openshift/enhancements#291

    I did read through that but it's very tied to solving the problem by embedding an ignition in an ISO, rather than letting ignition do some things before and after networkmanger is up.

  5. stbenjam commented on May 14, 2020

    @stbenjam
    Author

    See also coreos/ignition-dracut#94

    Yea that's a similar problem, but we are using https://coreos.com/os/docs/latest/config-drive.html instead, so I'm not sure this issue helps us

  6. cgwalters commented on May 14, 2020

    @cgwalters
    Member

    What I'd argued in one of the epic number of tickets around this is that I think all we need to do for all the major clouds that use the link-local address is bring up networking enough to do that, then we could pull network configuration out of the Ignition itself - then we can do static networking in clouds too (not that most people want this).

    That said, if we fixed openshift/machine-config-operator#1690 then you guys could "flatten" the config into /boot/config.ign and then you wouldn't need networking in the initramfs at all, right? I go back and forth on whether or not this is a good idea; it takes away some control from the MCO.

    rather than letting ignition do some things before and after networkmanger is up.

    But we'd need to flesh out more what that would look like. Something like:

    "initramfs-network": {
        "dhcp": false,
        "args": "ip=192.xxx...."
    

    Or just support writing arbitrary things into /etc/NetworkManager before it starts, basically a filesystem bit that applies to the initramfs?

  7. stbenjam commented on May 14, 2020

    @stbenjam
    Author

    That said, if we fixed openshift/machine-config-operator#1690 then you guys could "flatten" the config into /boot/config.ign and then you wouldn't need networking in the initramfs at all, right? I go back and forth on whether or not this is a good idea; it takes away some control from the MCO.

    That addresses the immediate problem for us, but not the general use. It makes complete sense to use network data sources for append/merge in ignition, but there's always going to be a circular dependency on environments that have networks that need configuration.

    rather than letting ignition do some things before and after networkmanger is up.
    But we'd need to flesh out more what that would look like. Something like:
    "initramfs-network": {
    "dhcp": false,
    "args": "ip=192.xxx...."
    Or just support writing arbitrary things into /etc/NetworkManager before it > starts, basically a filesystem bit that applies to the initramfs?

    Maybe? I don't understand entirely how the initramfs dracut/ignition stuff interact -- is the /etc/NetworkManager at that stage in the ramdisk or is that the host's eventual configuration?

  8. cgwalters commented on May 15, 2020

    @cgwalters
    Member

    We may need a meeting on this but I really want to walk though how the Live ISO changes the game for you guys. Hmm....I think we maybe do need to support some flag/mechanism for the Live ISO to disable networking in the initramfs even if Ignition is injected.

    Maybe? I don't understand entirely how the initramfs dracut/ignition stuff interact -- is the /etc/NetworkManager at that stage in the ramdisk or is that the host's eventual configuration?

    We use NM in the initrd too (RHCOS will after 8.2). There's no required linkage between the initramfs configuration and the real root; most people will want them to be the same (see coreos/ignition-dracut#89 ) but like that PR we can add an option to avoid propagating them to the real root.

  9. jlebon commented on May 15, 2020

    @jlebon
    Member

    Related: #956 (which would also be smart enough to handle live ISO with embedded Ignition configs). It's also an on-ramp for supporting fetching Ignition configs over link-local addresses.

  10. jlebon commented on May 15, 2020

    @jlebon
    Member

    I'm very hesitant to allow Ignition to configure the initramfs itself. I'd prefer we stay away from that for as long as we can because it essentially introduces the same problem for the initrd which Ignition was meant to solve for the real root.

    It makes complete sense to use network data sources for append/merge in ignition, but there's always going to be a circular dependency on environments that have networks that need configuration.

    We've been working hard on improving the situation there. :) In addition to the links above, see also coreos/fedora-coreos-tracker#460. I agree with Colin that we should push further on the live ISO embedded config path for bare metal, and investigate the link-local approach for clouds. (I'm also not sure how Ignition can correctly implement the RFE here if e.g. you configure networking in the base config, but then one of the merge configs actually wants to override what the config file should have been.)

  11. stbenjam commented on May 15, 2020

    @stbenjam
    Author

    I'm very hesitant to allow Ignition to configure the initramfs itself. I'd prefer we stay away from that for as long as we can because it essentially introduces the same problem for the initrd which Ignition was meant to solve for the real root.

    Would it be kernel command line arguments then for this configuration? I wasn't sure if that worked in rhcos, since we tried it when we were trying to get IPv6 working. Can you do VLAN configuration with those arguments?

    It makes complete sense to use network data sources for append/merge in ignition, but there's always going to be a circular dependency on environments that have networks that need configuration.
    We've been working hard on improving the situation there. :) In addition to the links above, see also coreos/fedora-coreos-tracker#460. I agree with Colin that we should push further on the live ISO embedded config path for bare metal, and investigate the link-local approach for clouds.

    The ISO approach for bare metal isn't going to work in the IPI case, and that seems to be ignored in the present designs. We do exist and have customers. We have some initial discussions about how we can use the live ISO for IPI but it's going to be later than we need this problem solved.

    I also don't see how the live ISO case fits into OpenShift, because the installer generates a stub ignition with network dependencies and you're going to run into customers with these complex network requirements. I don't see where that use case is being addressed.

    (I'm also not sure how Ignition can correctly implement the RFE here if e.g. you configure networking in the base config, but then one of the merge configs actually wants to override what the config file should have been.)

    You could have something like afterburn to be able to do preflight configuration before ignition runs.

    OpenStack config drives have network metadata for similar reasons: https://docs.openstack.org/nova/latest/user/metadata.html.

  12. cgwalters commented on May 19, 2020

    @cgwalters
    Member

    I'm very hesitant to allow Ignition to configure the initramfs itself. I'd prefer we stay away from that for as long as we can because it essentially introduces the same problem for the initrd which Ignition was meant to solve for the real root.

    If it's just constrained to networking though, that seems not too bad.

    And actually perhaps to start, we could offer exactly one thing - the ability for Ignition to disable initramfs networking. That would allow using coreos-installer iso embed to be fully programmable - the system boots live, the live Ignition can bring up the network however it wants (or not), and run coreos-installer however it wants, providing that Ignition config however it wants, etc.

    In particular once we have osmet, I suspect a lot of cases could get away with not even bringing up the network at all in the live OS.

  13. changed the title [-]Support running part of ignition before networking comes up[/-] [+]Support disabling initramfs networking via Ignition[/+] on May 21, 2020
  14. cgwalters commented on May 21, 2020

    @cgwalters
    Member

    Yeah I am increasingly certain that we missed this important case of "Ignition provided, but does not require networking in the initramfs" in all of the recent work following coreos/fedora-coreos-tracker#443

    I took a look at the recent libvirt testing scripts and it looks like to me theyl use the default bridged network which still has DHCP enabled. So what happens here is when we're doing a static config in those tests...we still used (and required!) DHCP in the initramfs.

    That's not going to work for environments without DHCP at all, or even just ones where we don't want to DHCP on each NIC but not all of them etc.

    openshift/enhancements#291 is not complete IMO until we fix this.

    Oh right actually, this is exactly what this issue is: coreos/coreos-installer#164

  15. 46 remaining items

  16. dtantsur commented on Jun 22, 2020

    @dtantsur

    the deployer is now responsible for knowing internal details of how we are moving things around in RHCOS/FCOS land.

    Yeah, it would practically require a downstream addition to the ramdisk. I'd like to note that ironic-python-agent is designed to be pretty flexible, so it's not an entirely bad thing either. We're working on a thing called "deploy steps" specifically to allow site-specific customizations.

    it has been done before

    I think CoreOS was so different at the time that it won't help us (and we did some ugly things like chroot in tarball contents).

  17. jlebon commented on Jun 22, 2020

    @jlebon
    Member

    the baremetal box is treated like a cloud VM - you provide an OS disk image, and optionally some user-data/meta-data (which in the metal3 case happens via a config-drive partition)

    OK right, that makes a lot of sense now.

    I suspect this is where we want to get to, the main challenge is right now we depend on some features of ironic-python-agent (in particular introspection), so the RHCOS/FCOS ramdisk isn't a drop-in replacement.

    So to recap, I think we're agreed on where we want to go long-term. And the question now is how to get this working in the short-term with the existing constraints of the deployer. @hardys Do I understand correctly that the "edit image" hack should work for now?

    If we can do the flattened Ignition config thing, this could also be solved by coreos/fedora-coreos-config#426.

  18. hardys commented on Jul 21, 2020

    @hardys

    So to recap, I think we're agreed on where we want to go long-term. And the question now is how to get this working in the short-term with the existing constraints of the deployer. @hardys Do I understand correctly that the "edit image" hack should work for now?

    If we can do the flattened Ignition config thing, this could also be solved by coreos/fedora-coreos-config#426.

    Sorry for the delay responding @jlebon yes I think that's accurate, so to summarize:

    @stbenjam @kirankt does that sound reasonable?

  19. dtantsur commented on Jul 21, 2020

    @dtantsur

    Short term workaround is to edit the RHCOS image (we'll need some docs/kbase downstream for this)

    In recent ironic (~ a week ago) you can drop a python plugin to IPA that will be called automatically during deployment to do.. pretty much whatever you want. We can have a downstream plugin that does $stuff for us as a short-term workaround.

  20. hardys commented on Jul 21, 2020

    @hardys

    Short term workaround is to edit the RHCOS image (we'll need some docs/kbase downstream for this)

    In recent ironic (~ a week ago) you can drop a python plugin to IPA that will be called automatically during deployment to do.. pretty much whatever you want. We can have a downstream plugin that does $stuff for us as a short-term workaround.

    @dtantsur sounds interesting - can you link any docs/examples? Could we modify /boot (sed the grub.cfg and/or drop some file in there) after IPA writes the OS image? What would the interface from ironic look like?

  21. dtantsur commented on Jul 22, 2020

    @dtantsur

    sounds interesting - can you link any docs/examples?

    It's a brand new feature, I'm going to work on examples this/next week.

    Could we modify /boot (sed the grub.cfg and/or drop some file in there) after IPA writes the OS image?

    Yes! But do you really need it to happen afterwards or do you need to modify /etc/defaults/grub before grub installation? I think the latter is a bit more robust.

    What would the interface from ironic look like?

    There are options. If we create an openshift-specific plugin, it may have no interface at all, just silently do what we need. If you could remind me what exactly we need to do (I'm a bit lost in the history of this issue), I can say specifically.

  22. jlebon commented on Jul 22, 2020

    @jlebon
    Member

    Could we modify /boot (sed the grub.cfg and/or drop some file in there) after IPA writes the OS image?

    Yes! But do you really need it to happen afterwards or do you need to modify /etc/defaults/grub before grub installation? I think the latter is a bit more robust.

    Note FCOS and RHCOS don't use grub2-mkconfig, but pure BLS: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/. So the canonical kargs live in the BLS configs at $(boot)/loader/entries/ and that's what you'd typically modify after install. But here we're mostly talking about mounting boot in order to drop network configs in there.

    All these are things that coreos-installer has native support for (via e.g. --copy-network, --append-karg, --delete-karg), so once we switch over to that for the install, it'll be easier/safer to do these modifications.

  23. dtantsur commented on Jul 22, 2020

    @dtantsur

    All these are things that coreos-installer has native support for (via e.g. --copy-network, --append-karg, --delete-karg), so once we switch over to that for the install, it'll be easier/safer to do these modifications.

    I'm not sure it's going to happen, at least not in all scenarios.

  24. hardys commented on Jul 23, 2020

    @hardys

    All these are things that coreos-installer has native support for (via e.g. --copy-network, --append-karg, --delete-karg), so once we switch over to that for the install, it'll be easier/safer to do these modifications.

    @jlebon can you link any docs on how this works in an automated environment? E.g if you pxe boot the installer ramdisk, how does this data get provided to coreos-installer for a non-interactive deploy?

    As @dtantsur says there is some uncertainty/challenge in making this change (hence I mention it as a long term plan above), so we'll need to investigate further.

    We'll need to document a workaround in the meantime - does anything exist (upstream or downstream) that describes the process of using virt-customize to drop additional network configuration in /boot? (I know the virt-customize commands, but not certain on the network file format expected, and we need something downstream to share with $customer).

  25. jlebon commented on Jul 23, 2020

    @jlebon
    Member

    @jlebon can you link any docs on how this works in an automated environment? E.g if you pxe boot the installer ramdisk, how does this data get provided to coreos-installer for a non-interactive deploy?

    We don't have good docs yet for that right now, but in an automated environment, you would script a systemd unit which calls coreos-installer install --copy-network --append-karg foo ....

    If you're rolling your own code, you can of course do the same thing coreos-installer does when handling these args. For --copy-network, you would copy the NM keyfiles into $bootmnt/coreos-firstboot-network (see the code that handles this on firstboot here: https://github.com/coreos/fedora-coreos-config/blob/87f5c512ad60e4f37c2b10434dda2e59e40dd97a/overlay.d/05core/usr/lib/dracut/modules.d/15coreos-network/coreos-copy-firstboot-network.sh). For kargs, you can modify the options line in the BLS configs in $bootmnt/loader/entries.

  26. dustymabe commented on Aug 21, 2020

    @dustymabe
    Member

    Since coreos/fedora-coreos-config#426 merged (fixes coreos/fedora-coreos-tracker#443) it feels like the question of how to "Support disabling initramfs networking via Ignition" is answered.

    • Q: How do I disable initramfs networking via Ignition?
    • A: You provide an Ignition config that doesn't have any remote references.
      • This implies it doesn't require networking and no networking will be brought up in the initramfs.

    The caveat to this is that there are some platforms that only get their Ignition configuration by using the network, so it's not really possible to disable it on those platforms, nor would you want to.

    Shall we close this issue out?

  27. hardys commented on Sep 2, 2020

    @hardys

    Since coreos/fedora-coreos-config#426 merged (fixes coreos/fedora-coreos-tracker#443) it feels like the question of how to "Support disabling initramfs networking via Ignition" is answered.

    * Q: How do I disable initramfs networking via Ignition?
    
    * A: You provide an Ignition config that doesn't have any remote references.
      
      * This implies it doesn't require networking and no networking will be brought up in the initramfs.
    

    The caveat to this is that there are some platforms that only get their Ignition configuration by using the network, so it's not really possible to disable it on those platforms, nor would you want to.

    I pushed openshift/enhancements#467 so we can discuss some ideas around the "flattened ignition" solution, which (where appropriate, and in particular for IPI baremetal) could enable a MCO managed Ignition config that doesn't have any remote references

    Shall we close this issue out?

    It seems the the conclusion of the discussion so far is that we won't fix this by adding some new ignition interface for early network config, so that seems reasonable to me.

  28. dustymabe commented on Sep 2, 2020

    @dustymabe
    Member

    Thanks @hardys - Will follow along the discussion in openshift/enhancements#467

  29. dustymabe commented on Sep 2, 2020

    @dustymabe
    Member

    For people following Fedora CoreOS: the work for coreos/fedora-coreos-tracker#443 was first introduced in testing stream release 32.20200715.2.2 and stable stream release 32.20200715.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions