Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions dracut/50flatcar-network/10-nodeps.conf

This file was deleted.

15 changes: 4 additions & 11 deletions dracut/50flatcar-network/afterburn-network-kargs.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,18 @@
Description=Afterburn Initrd Setup Network Kernel Arguments
Documentation=https://coreos.github.io/afterburn/usage/initrd-network-cmdline/

# This service may produce additional kargs fragments,
# which are then consumed by dracut-cmdline(8).
DefaultDependencies=no
Before=parse-ip-for-networkd.service systemd-networkd.service
PartOf=systemd-networkd.service
Before=dracut-cmdline.service
# For extra safety
ConditionKernelCommandLine=|coreos.oem.id=vmware
ConditionKernelCommandLine=|flatcar.oem.id=vmware
ConditionKernelCommandLine=|coreos.oem.id=proxmoxve
ConditionKernelCommandLine=|flatcar.oem.id=proxmoxve

OnFailure=emergency.target
OnFailureJobMode=replace-irreversibly

# Flatcar: Load coreos-metadata binary
Requires=sysusr-usr.mount
After=sysusr-usr.mount

[Service]
ExecStart=/usr/bin/coreos-metadata exp rd-network-kargs --cmdline --default-value ''
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=systemd-networkd.service
66 changes: 27 additions & 39 deletions dracut/50flatcar-network/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,50 @@

# called by dracut
depends() {
echo net-lib systemd-networkd
echo net-lib systemd-networkd systemd-resolved
}

# called by dracut
install() {
inst_multiple -o \
$systemdutildir/systemd-resolved \
$systemdsystemunitdir/systemd-resolved.service \
/etc/systemd/resolved.conf

inst_multiple \
"$systemdnetwork"/{20-calico-tunl0,50-veth,98-{gce-coreos-virtio,gce-virtio,virtio}}.link

inst_simple "$moddir/network-cleanup.service" \
"$systemdsystemunitdir/network-cleanup.service"

inst_simple "$moddir/parse-ip-for-networkd.service" \
"$systemdsystemunitdir/parse-ip-for-networkd.service"

inst_simple "$moddir/afterburn-network-kargs.service" \
"$systemdsystemunitdir/afterburn-network-kargs.service"
"$systemdnetwork"/98-{gce-coreos-virtio,gce-virtio,virtio}.link \
"$systemdnetwork"/yy-{azure-sriov{,-coreos},pxe}.network \
"$systemdnetwork"/zz-default.network

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.

If those are provided by coreos-init - should we add it as a post dependency to the bootengine ebuild?


inst_simple "$moddir/10-nodeps.conf" \
"$systemdsystemunitdir/systemd-resolved.service.d/10-nodeps.conf"

inst_simple "$moddir/yy-azure-sriov.network" \
"$systemdnetwork/yy-azure-sriov.network"
# Don't keep the configuration, otherwise the IP address is not released.
# This can cause problems when a different DHCP client configuration is set
# on first boot. The DHCP server would not recognize the rootfs system and
# would therefore keep two addresses allocated.
sed -i -r 's:^(KeepConfiguration)=.*:\1=no:' \
"$initdir/$systemdnetwork"/{yy-pxe,zz-default}.network

inst_simple "$moddir/yy-digitalocean.network" \
"$systemdnetwork/yy-digitalocean.network"

inst_simple "$moddir/yy-digitalocean-coreos.network" \
"$systemdnetwork/yy-digitalocean-coreos.network"

inst_simple "$moddir/yy-netroot.network" \
"$systemdnetwork/yy-netroot.network"

inst_simple "$moddir/yy-pxe.network" \
"$systemdnetwork/yy-pxe.network"

inst_simple "$moddir/zz-default.network" \
"$systemdnetwork/zz-default.network"
inst_simple "$moddir/network-cleanup.service" \
"$systemdsystemunitdir/network-cleanup.service"

# add a hook to generate networkd configuration from ip= arguments
inst_hook cmdline 99 "$moddir/parse-ip-for-networkd.sh"
inst_simple "$moddir/afterburn-network-kargs.service" \
"$systemdsystemunitdir/afterburn-network-kargs.service"

# user/group required for systemd-resolved
getent passwd systemd-resolve >> "$initdir/etc/passwd"
getent group systemd-resolve >> "$initdir/etc/group"
# Feed afterburn-injected kargs (in Dracut's cmdline.d) to
# systemd-network-generator, which only reads /proc/cmdline.
inst_simple "$moddir/systemd-network-generator-afterburn.conf" \
"$systemdsystemunitdir/systemd-network-generator.service.d/10-afterburn.conf"

# point /etc/resolv.conf @ systemd-resolved's resolv.conf
ln -s ../run/systemd/resolve/resolv.conf "$initdir/etc/resolv.conf"
# The systemd-networkd and systemd-resolved Dracut modules enable their
# services by default, but we only want them when pulled in on demand.
systemctl --root "$initdir" disable systemd-networkd.{service,socket} systemd-resolved.service

# the systemd-networkd dracut module enables networkd by default, but
# we only want it when pulled in
systemctl --root "$initdir" disable systemd-networkd.service
systemctl --root "$initdir" disable systemd-networkd.socket
# Disabling systemd-networkd also disables its generator because the former
# lists the latter in its [Install] Also=, so explicitly re-enable it.
systemctl --root "$initdir" enable systemd-network-generator.service

systemctl --root "$initdir" enable network-cleanup.service
systemctl --root "$initdir" enable parse-ip-for-networkd.service
systemctl --root "$initdir" enable afterburn-network-kargs.service
}
18 changes: 0 additions & 18 deletions dracut/50flatcar-network/parse-ip-for-networkd.service

This file was deleted.

138 changes: 0 additions & 138 deletions dracut/50flatcar-network/parse-ip-for-networkd.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
# Augment command line with Afterburn before running systemd-network-generator.
Wants=afterburn-network-kargs.service
After=afterburn-network-kargs.service

[Service]
# systemd-network-generator only parses /proc/cmdline or SYSTEMD_PROC_CMDLINE.
# Afterburn writes SYSTEMD_PROC_CMDLINE here; ignore it when absent.
EnvironmentFile=-/run/afterburn/network-generator.env
15 changes: 0 additions & 15 deletions dracut/50flatcar-network/yy-azure-sriov-coreos.network

This file was deleted.

15 changes: 0 additions & 15 deletions dracut/50flatcar-network/yy-azure-sriov.network

This file was deleted.

3 changes: 3 additions & 0 deletions dracut/50flatcar-network/yy-netroot.network
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[Match]
# Only virtual NICs have a Kind, and we want to exclude those.
Kind=!?*
Type=!loopback
KernelCommandLine=netroot

[Network]
Expand Down
12 changes: 0 additions & 12 deletions dracut/50flatcar-network/yy-pxe.network

This file was deleted.

14 changes: 0 additions & 14 deletions dracut/50flatcar-network/zz-default.network

This file was deleted.

3 changes: 0 additions & 3 deletions dracut/53ignition/flatcar-afterburn-network.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ DefaultDependencies=false
Before=initrd.target
After=systemd-networkd.service initrd-root-fs.target
Wants=systemd-networkd.service initrd-root-fs.target
# Flatcar: Load coreos-metadata binary
Requires=sysusr-usr.mount
After=sysusr-usr.mount

[Service]
Type=oneshot
Expand Down
3 changes: 0 additions & 3 deletions dracut/53ignition/flatcar-metadata-hostname.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ DefaultDependencies=false
Before=initrd.target
After=systemd-networkd.service initrd-root-fs.target
Wants=systemd-networkd.service initrd-root-fs.target
# Flatcar: Load coreos-metadata binary
Requires=sysusr-usr.mount
After=sysusr-usr.mount

# Ensure Ignition can overwrite /etc/hostname
Before=ignition-files.service
Expand Down
3 changes: 0 additions & 3 deletions dracut/53ignition/flatcar-openstack-hostname.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ DefaultDependencies=false
Before=initrd.target
After=systemd-networkd.service initrd-root-fs.target
Wants=systemd-networkd.service initrd-root-fs.target
# Flatcar: Load coreos-metadata binary
Requires=sysusr-usr.mount
After=sysusr-usr.mount

# Ensure Ignition can overwrite /etc/hostname
Before=ignition-files.service
Expand Down
Loading