Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: install subcommand should allow just postprocess #1115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omertuc
Copy link
Contributor

@omertuc omertuc commented Feb 21, 2023

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.

# 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:

```bash
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant