From e9434d17f77dfb1821d7ad750269d16ef6a664ad Mon Sep 17 00:00:00 2001 From: Jakob Meng Date: Wed, 13 Sep 2023 14:56:11 +0200 Subject: [PATCH] [DNM][DRAFT] Agent-based Installer test for OKD/FCOS --- .../usr/local/bin/bootstrap-pivot.sh.template | 25 +++++++++++-------- .../release-image-pivot.service.template | 4 --- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/data/data/bootstrap/files/usr/local/bin/bootstrap-pivot.sh.template b/data/data/bootstrap/files/usr/local/bin/bootstrap-pivot.sh.template index 86a42bb9cc2..f091384f4cc 100644 --- a/data/data/bootstrap/files/usr/local/bin/bootstrap-pivot.sh.template +++ b/data/data/bootstrap/files/usr/local/bin/bootstrap-pivot.sh.template @@ -1,6 +1,7 @@ {{if .IsOKD -}} #!/usr/bin/env bash set -euo pipefail +set -x # Exit early if pivot is attempted on SCOS Live ISO {{if .IsSCOS -}} @@ -41,13 +42,21 @@ if [ ! -f /opt/openshift/.pivot-done ]; then record_service_stage_start "rebase-to-okd-os-image" {{if .IsFCOS -}} + # get more space because 7.8gb is not enough + /bin/truncate -s 12G /run/ephemeral_base/loopfs + losetup -c /dev/loop0 + xfs_growfs /var + #xfs_growfs /var/lib/containers/storage/overlay + mount -o remount,size=12G /run + mnt="$(podman image mount "${MACHINE_OS_IMAGE}")" -{{- if .BootstrapInPlace }} - # SNO setup boots into Live ISO which cannot be rebased - # https://github.com/coreos/rpm-ostree/issues/4547 + podman volume create machine-os-image + machine_os_image=$(podman volume inspect machine-os-image --format '{{`{{ .Mountpoint }}`}}') + rsync -aHAXx "$mnt/" "$machine_os_image/" + mkdir /var/mnt/{upper,worker} - mount -t overlay overlay -o "lowerdir=/usr:$mnt/usr" /usr - mount -t overlay overlay -o "lowerdir=/etc:$mnt/etc,upperdir=/var/mnt/upper,workdir=/var/mnt/worker" /etc + mount -t overlay overlay -o "lowerdir=/usr:$machine_os_image/usr" /usr + rsync -rlt --ignore-existing "$machine_os_image/etc/" /etc/ systemctl daemon-reload # Workaround for SELinux denials when launching crio.service from overlayfs @@ -55,12 +64,6 @@ if [ ! -f /opt/openshift/.pivot-done ]; then systemctl start crio.service # No reboot necessary because SNO setup will reboot system -{{ else }} - pushd "${mnt}/bootstrap" - # shellcheck disable=SC1091 - . ./pre-pivot.sh - popd -{{ end -}} {{else if .IsSCOS -}} chmod 0644 /etc/containers/registries.conf rpm-ostree rebase --experimental "ostree-unverified-registry:${MACHINE_OS_IMAGE}" diff --git a/data/data/bootstrap/systemd/units/release-image-pivot.service.template b/data/data/bootstrap/systemd/units/release-image-pivot.service.template index e278091cc50..fd3763f44c2 100644 --- a/data/data/bootstrap/systemd/units/release-image-pivot.service.template +++ b/data/data/bootstrap/systemd/units/release-image-pivot.service.template @@ -3,11 +3,7 @@ Description=Pivot bootstrap to the OpenShift Release Image Wants=release-image.service After=release-image.service -{{- if .BootstrapInPlace }} Before=bootkube.service kubelet.service -{{ else }} -Before=bootkube.service -{{ end -}} [Service] Type=oneshot