Skip to content

Commit

Permalink
bootkube.sh: pivot bootstrap node for OKD installs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vrutkovs committed Dec 2, 2020
1 parent b41e7cb commit 0b1dac5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Expand Up @@ -17,3 +17,44 @@ 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

# Copy machine-config-daemon binary from payload
MACHINE_CONFIG_OPERATOR_IMAGE=$(image_for machine-config-operator)
mkdir --parents bin/
podman run --quiet --net=host --entrypoint=cat "${MACHINE_CONFIG_OPERATOR_IMAGE}" \
/usr/bin/machine-config-daemon > /usr/local/bin/machine-config-daemon
chmod +x /usr/local/bin/machine-config-daemon
restorecon /usr/local/bin/machine-config-daemon

set -x

# Pre-pull machine-os-content image
mkdir --parents /tmp/bootstrap
MACHINE_CONFIG_OSCONTENT=$(image_for machine-os-content)
podman pull "${MACHINE_CONFIG_OSCONTENT}"
mnt=$(podman image mount "${MACHINE_CONFIG_OSCONTENT}")
pushd ${mnt}/bootstrap
cp overlay/etc / -rvf
cp overlay/usr/local/bin/* /usr/local/bin/ -rvf
cp manifests/* /opt/openshift/openshift/ -rvf
popd

# GCP: enable gcp-routes services
systemctl daemon-reload
systemctl enable openshift-gcp-routes.service || true

# Set image-pullspec for pivot
mkdir --parents /run/pivot /etc/pivot
touch /run/pivot/reboot-needed
echo "${MACHINE_CONFIG_OSCONTENT}" > /etc/pivot/image-pullspec

touch /opt/openshift/.pivot-done
/usr/local/bin/machine-config-daemon pivot

systemctl reboot
fi
{{end -}}
2 changes: 2 additions & 0 deletions pkg/asset/ignition/bootstrap/bootstrap.go
Expand Up @@ -57,6 +57,7 @@ type bootstrapTemplateData struct {
Registries []sysregistriesv2.Registry
BootImage string
PlatformData platformTemplateData
IsOKD bool
}

// platformTemplateData is the data to use to replace values in bootstrap
Expand Down Expand Up @@ -266,6 +267,7 @@ func (a *Bootstrap) getTemplateData(installConfig *types.InstallConfig, releaseI
Registries: registries,
BootImage: string(*rhcosImage),
PlatformData: platformData,
IsOKD: installConfig.IsOKD(),
}, nil
}

Expand Down

0 comments on commit 0b1dac5

Please sign in to comment.