From 9143f0ffbd51e00519db9fc4813b3e01c681ae6d Mon Sep 17 00:00:00 2001 From: Vadim Rutkovsky Date: Mon, 2 Mar 2020 19:11:23 +0100 Subject: [PATCH] bootkube.sh: pivot bootstrap node for OKD installs OKD is using plain FCOS, which doesn't have MCD binary to pivot. It should extract it from machine-config-daemon image and run pivot manually. This also extract necessary files and manifests from machine-os-content image --- .../bin/release-image-download.sh.template | 17 +++++++++++++++++ pkg/asset/ignition/bootstrap/bootstrap.go | 2 ++ 2 files changed, 19 insertions(+) diff --git a/data/data/bootstrap/files/usr/local/bin/release-image-download.sh.template b/data/data/bootstrap/files/usr/local/bin/release-image-download.sh.template index 71a73484d29..7cabadddc9d 100755 --- a/data/data/bootstrap/files/usr/local/bin/release-image-download.sh.template +++ b/data/data/bootstrap/files/usr/local/bin/release-image-download.sh.template @@ -17,3 +17,20 @@ do echo "Pull failed. Retrying $RELEASE_IMAGE..." done +{{if .IsOKD -}} +# Pivot bootstrap to FCOS + OKD machine-os-content +if [ ! -f /opt/openshift/.pivot-done ]; then + . /usr/local/bin/release-image.sh + + # Run pre-pivot.sh script to update bootstrap node + MACHINE_CONFIG_OSCONTENT=$(image_for machine-os-content) + while ! podman pull --quiet "$MACHINE_CONFIG_OSCONTENT" + do + echo "Pull failed. Retrying $MACHINE_CONFIG_OSCONTENT..." + done + mnt=$(podman image mount "${MACHINE_CONFIG_OSCONTENT}") + pushd ${mnt}/bootstrap + . ./pre-pivot.sh + popd +fi +{{end -}} diff --git a/pkg/asset/ignition/bootstrap/bootstrap.go b/pkg/asset/ignition/bootstrap/bootstrap.go index 0c40e84a1ff..3df076cbf3f 100644 --- a/pkg/asset/ignition/bootstrap/bootstrap.go +++ b/pkg/asset/ignition/bootstrap/bootstrap.go @@ -59,6 +59,7 @@ type bootstrapTemplateData struct { Registries []sysregistriesv2.Registry BootImage string PlatformData platformTemplateData + IsOKD bool } // platformTemplateData is the data to use to replace values in bootstrap @@ -278,6 +279,7 @@ func (a *Bootstrap) getTemplateData(installConfig *types.InstallConfig, releaseI BootImage: string(*rhcosImage), PlatformData: platformData, ClusterProfile: clusterProfile, + IsOKD: installConfig.IsOKD(), }, nil }