@@ -42,25 +42,72 @@ if [ ! -f /opt/openshift/.pivot-done ]; then
4242 record_service_stage_start "rebase-to-okd-os-image"
4343{{if .IsFCOS -}}
4444 mnt="$(podman image mount "${MACHINE_OS_IMAGE}")"
45- {{- if or (.BootstrapInPlace) (eq .Invoker "agent-installer") }}
46- # SNO setup boots into Live ISO which cannot be rebased
47- # https://github.com/coreos/rpm-ostree/issues/4547
48- mkdir /var/mnt/{upper,worker}
49- mount -t overlay overlay -o "lowerdir=/usr:$mnt/usr" /usr
50- mount -t overlay overlay -o "lowerdir=/etc:$mnt/etc,upperdir=/var/mnt/upper,workdir=/var/mnt/worker" /etc
51- systemctl daemon-reload
5245
53- # Workaround for SELinux denials when launching crio.service from overlayfs
54- setenforce Permissive
46+ # The bootstrap host during SNO installation and the rendezvous host of Agent-based Installer both boot into a Live
47+ # ISO which cannot be rebased. Until rpm-ostree supports this live rebase [0], the following workaround will mount the
48+ # proper OKD/FCOS Machine OS image over the existing mount at /usr and copy new config files to /etc.
49+ # [0] https://github.com/coreos/rpm-ostree/issues/4547
50+ if grep -q coreos.liveiso= /proc/cmdline; then
51+ mount -t tmpfs -o size=50% none /var/mnt/
52+ rsync -aHAXx "$mnt/" /var/mnt/
53+ mount -t overlay overlay -o lowerdir=/usr:/var/mnt/usr /usr
54+ rsync -rlt --ignore-existing /var/mnt/etc/ /etc/
5555
56- systemctl start crio.service
57- # No reboot necessary because SNO setup will reboot system
58- {{ else }}
59- pushd "${mnt}/bootstrap"
60- # shellcheck disable=SC1091
61- . ./pre-pivot.sh
62- popd
63- {{ end -}}
56+ # Agent-based Installer will launch a ephemeral control plane at the rendezvous host which will create and publish
57+ # Ignition configs for the other master nodes. These Ignition configs must match what the in-cluster control plane
58+ # would generate else machine config operator will fail [0]. Because the rendezvous host is booted with a FCOS Live
59+ # ISO without any OKD/FCOS related changes, we have to copy the manifests from OKD Machine OS manually to the
60+ # bootstrap manifests folder of the rendezvous host.
61+ # [0] https://access.redhat.com/solutions/4970731
62+ mkdir -p /var/opt/openshift/manifests
63+ cp -av /var/mnt/manifests/*.* /var/opt/openshift/manifests/
64+
65+ # Load new systemd unit files and configuration such as crio.service after mounting the content of OKD/FCOS Machine
66+ # OS over /usr and copying new files to /etc
67+ systemctl daemon-reload
68+
69+ # Apply presets from OKD Machine OS
70+ systemctl preset-all
71+
72+ # On OKD/FCOS prior to commit e859a66 [0] systemd-resolved is used by default and NetworkManager's DNS handling is
73+ # disabled. In this case, CoreDNS fails to listen to 127.0.0.53:53 when Agent-based Installer boots its the
74+ # rendezvous host with a Fedora CoreOS bootimage because by default FCOS' systemd-resolved already listens to this
75+ # port. OKD/FCOS disables resolved's stub listener [1] but the resolved must be restarted for this setting to take
76+ # effect.
77+ # On OKD/FCOS since commit e859a66 [0] systemd-resolved is disabled by default and NetworkManager's DNS handling is
78+ # used. However, the bootimage is vanilla FCOS and thus uses systemd-resolved by default. The latter has to be
79+ # disabled after rebasing to OKD Machine OS and NetworkManager as well as the service to fix /etc/resolv.conf have
80+ # to be started.
81+ # [0] https://github.com/openshift/okd-machine-os/commit/e859a6643330596a8a282aeb4bf853763a2d219e
82+ # [1] https://github.com/openshift/okd-machine-os/blob/28dec35d60ea07069366b22ebdcb296d429b15e9/overlay.d/99okd/etc/systemd/resolved.conf.d/okd-no-dns-stub.conf
83+ if [ -e /etc/systemd/resolved.conf.d/okd-no-dns-stub.conf ]; then
84+ systemctl restart systemd-resolved.service
85+ else
86+ systemctl disable --now systemd-resolved.service
87+ fi
88+
89+ if systemctl list-unit-files -q fix-resolvconf.service >/dev/null; then
90+ systemctl stop NetworkManager.service
91+ systemctl start fix-resolvconf.service
92+ systemctl start NetworkManager.service
93+ nmcli general reload dns-full
94+ fi
95+
96+ # Workaround for SELinux denials when launching crio.service from overlayfs
97+ setenforce Permissive
98+
99+ # crio.service is not part of FCOS but of OKD Machine OS. It will loaded after systemctl daemon-reload above but has
100+ # to be started manually
101+ systemctl start crio.service
102+
103+ # No reboot necessary because setup will reboot the system automatically
104+ else
105+ pushd "${mnt}/bootstrap"
106+ # shellcheck disable=SC1091
107+ . ./pre-pivot.sh
108+ popd
109+ fi
110+ record_service_stage_success
64111{{else if .IsSCOS -}}
65112 chmod 0644 /etc/containers/registries.conf
66113 rpm-ostree rebase --experimental "ostree-unverified-registry:${MACHINE_OS_IMAGE}"
0 commit comments