Skip to content

Commit

Permalink
Move to conditional networking
Browse files Browse the repository at this point in the history
We have all the piece in place now to move to conditional networking. So
let's drop the firstboot kargs, as well as
coreos-liveiso-network-kargs.service, which is no longer needed (i.e.
the live ISO will now enable initrd networking as required given the
embedded Ignition config).

Fixes: coreos/fedora-coreos-tracker#443
  • Loading branch information
jlebon committed Jul 14, 2020
1 parent 7c40c93 commit a6fa2b4
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 81 deletions.
6 changes: 3 additions & 3 deletions image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ extra-kargs:
# https://fedoraproject.org/wiki/Changes/CGroupsV2
- systemd.unified_cgroup_hierarchy=0

# Kernel arguments to be used on first-boot.
ignition-network-kcmdline:
- 'rd.neednet=1'
# Disable networking by default on firstboot. We can drop this once cosa stops
# defaulting to `ip=dhcp,dhcp6 rd.neednet=1` when it doesn't see this key.
ignition-network-kcmdline: []

# Optional remote by which to prefix the deployed OSTree ref
ostree-remote: fedora
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ After=coreos-gpt-setup@dev-disk-by\x2dlabel-root.service
# Since we are mounting /boot/, require the device first
Requires=dev-disk-by\x2dlabel-boot.device
After=dev-disk-by\x2dlabel-boot.device
# Need to run after fetch-offline stage since it may re-run the NM cmdline
# hook which will generate NM configs from the network kargs, but we want to
# have precedence.
After=ignition-fetch-offline.service

[Service]
Type=oneshot
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ add_requires sysroot.mount initrd-root-fs.target
add_requires sysroot-etc.mount initrd-root-fs.target
add_requires sysroot-var.mount initrd-root-fs.target

add_requires coreos-liveiso-network-kargs.service initrd.target
add_requires coreos-liveiso-reconfigure-nm-wait-online.service initrd.target

mkdir -p "${UNIT_DIR}/ostree-prepare-root.service.d"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ install() {
install_and_enable_unit "coreos-live-persist-osmet.service" \
"default.target"

inst_simple "$moddir/coreos-liveiso-network-kargs.sh" \
"/usr/sbin/coreos-liveiso-network-kargs"

inst_simple "$moddir/coreos-liveiso-network-kargs.service" \
"$systemdsystemunitdir/coreos-liveiso-network-kargs.service"

inst_simple "$moddir/coreos-liveiso-reconfigure-nm-wait-online.service" \
"$systemdsystemunitdir/coreos-liveiso-reconfigure-nm-wait-online.service"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
[Unit]
Description=CoreOS Live ISO virtio success
Documentation=https://github.com/coreos/fedora-coreos-config
# Only run on the Live ISO, and only if there's no Ignition config;
# the second bits here invert the conditionals in coreos-liveiso-network-kargs.service.
# Only run on the Live ISO, and only if there's no Ignition config
ConditionKernelCommandLine=coreos.liveiso
ConditionPathExists=!/config.ign
ConditionVirtualization=|kvm
Expand Down
22 changes: 22 additions & 0 deletions tests/kola/misc-ro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ fatal() {
exit 1
}

on_platform() {
grep -q " ignition.platform.id=$1 " /proc/cmdline
}

get_journal_msg_timestamp() {
journalctl -o json -b 0 --grep "$1" \
| jq -r --slurp '.[0]["__MONOTONIC_TIMESTAMP"]'
}

systemctl is-enabled logrotate.service
ok logrotate

Expand All @@ -19,3 +28,16 @@ if ip link | grep -o -e " eth[0-9]:"; then
fatal "detected eth* NIC naming on node"
fi
ok nic naming

switchroot_ts=$(get_journal_msg_timestamp 'Switching root.')
nm_ts=$(get_journal_msg_timestamp 'NetworkManager .* starting')
# by default, kola on QEMU shouldn't need to bring up networking
# https://github.com/coreos/fedora-coreos-config/pull/426
if [[ $nm_ts -lt $switchroot_ts ]] && on_platform qemu; then
fatal "NetworkManager started in initramfs!"
# and as a sanity-check that this test works, verify that on AWS
# we did bring up networking in the initrd
elif [[ $nm_ts -gt $switchroot_ts ]] && on_platform aws; then
fatal "NetworkManager not started in initramfs!"
fi
ok early networking

0 comments on commit a6fa2b4

Please sign in to comment.