coreos-installer icon indicating copy to clipboard operation
coreos-installer copied to clipboard

Proposal: install subcommand should allow just postprocess

Open omertuc opened this issue 2 years ago • 0 comments

Intro

This is more a proposal than a pull request. Since the change is simple, it's best to demonstrate it with a PR rather than just words.

Proposal

My proposal is that coreos-installer should allow optionally performing just the post-processing portion of the installation.

Why

This would be useful to improve the installation time in the context of single-node OCP bootstrap-in-place installations (a method also used by the OCP Assisted Installer).

How / Background

In that kind of installation, we create a bootstrap OpenShift control-plane running on a live ISO. When that control-plane is done forming we store the state of etcd among other things in an ignition file, install RHCOS to disk with said ignition then reboot to form a working OCP single node cluster.

Setting up a control plane already takes a long time, and writing the image to disk, especially when using metal machines which usually have to read the osmet data from a slow virtual media, also takes a long time.

Currently we have to perform these two actions serially - as we only have the ignition once the control plane is done forming.

If this proposal were to be merged, we could instead perform the image writing to disk, without any ignition, parallel to the bootstrap control-plane formation. Then once we have the ignition we could use this new --postprocess-only installation flag to have coreos-installer just quickly write the ignition to disk without having to do a lengthy image installation.

Alternatives

We currently have a workaround to do this without any changes to coreos-installer where we emulate the ignition writing behavior of this installer using simple bash commands:

boot_partition_device=$(sudo lsblk --paths --output-all --json | jq --arg device $TARGET_DEVICE '
  .blockdevices[]
  | select(.name == $device).children[]
  | select(.label == "boot").name
' -r)

MOUNT_POINT=/tmp/sno-boot-mount-ignition
IGNITION_DIR="${MOUNT_POINT}"/ignition

SRC_IGNITION=/opt/openshift/master.ign
DST_IGNITION="${IGNITION_DIR}"/config.ign

sudo umount "${MOUNT_POINT}" || true

sudo mkdir -p "${MOUNT_POINT}"
sudo mount $boot_partition_device "${MOUNT_POINT}"

sudo mkdir -p "${IGNITION_DIR}"
sudo chmod 700 "${IGNITION_DIR}"

sudo cp "${SRC_IGNITION}" "${DST_IGNITION}"
sudo chmod 600 "${DST_IGNITION}"

sudo umount "${MOUNT_POINT}"

But it is hacky / far from ideal and bound to break if the exact mechanisms of how ignition is written are ever to change. It's best if we could rely on coreos-installer to do this work.

omertuc avatar Feb 21 '23 21:02 omertuc