|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// microshift_running_applications/embed-microshift-offline-deploy.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="microshift-embed-microshift-image-offline-deployment_{context}"] |
| 7 | += Embedding {microshift-short} containers for offline deployments |
| 8 | + |
| 9 | +You can use Image Builder to create `rpm-ostree` system images with embedded {microshift-short} container images. To embed container images, you must add the image references to your Image Builder blueprint. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* You have root-user access to your build host. |
| 14 | +* Your build host meets the Image Builder system requirements. |
| 15 | +* You have installed and set up Image Builder and the `composer-cli` tool. |
| 16 | +* You have created a {op-system-ostree} image blueprint. |
| 17 | +* You have installed jq. |
| 18 | +
|
| 19 | +.Procedure |
| 20 | + |
| 21 | +. Get the exact list of container image references used by the {microshift-short} version you are deploying. You can either install the `microshift-release-info` RPM package by following step 2 or download and unpack the RPM by following step 3. |
| 22 | + |
| 23 | +. To install the `microshift-release-info` RPM package: |
| 24 | + |
| 25 | +.. Install the `microshift-release-info` RPM package by running the following command: |
| 26 | ++ |
| 27 | +[source,terminal] |
| 28 | +---- |
| 29 | +$ sudo dnf install -y microshift-release-info-<release_version> |
| 30 | +---- |
| 31 | +Replace `<release_version>` with the numerical value of the release you are deploying, using the entire version number, such as `4.14.0`. |
| 32 | + |
| 33 | +.. List the contents of the `/usr/share/microshift/release` directory to verify the presence of the release information files by running the following command: |
| 34 | ++ |
| 35 | +[source,terminal] |
| 36 | +---- |
| 37 | +$ ls /usr/share/microshift/release |
| 38 | +---- |
| 39 | ++ |
| 40 | +.Example output |
| 41 | +[source,terminal] |
| 42 | +---- |
| 43 | +release-x86_64.json |
| 44 | +release-aarch64.json |
| 45 | +---- |
| 46 | ++ |
| 47 | +If you installed the `microshift-release-info` RPM, you can proceed to step 4. |
| 48 | + |
| 49 | +. If you did not complete step 2, download and unpack the `microshift-release-info` RPM without installing it: |
| 50 | + |
| 51 | +.. Download the RPM package by running the following command: |
| 52 | ++ |
| 53 | +[source,terminal] |
| 54 | +---- |
| 55 | +$ sudo dnf download microshift-release-info-<release_version> |
| 56 | +---- |
| 57 | +Replace `<release_version>` with the numerical value of the release you are deploying, using the entire version number, such as `4.14.0`. |
| 58 | ++ |
| 59 | +.Example rpm |
| 60 | +[source,terminal] |
| 61 | +---- |
| 62 | +microshift-release-info-4.14.0.*.el9.noarch.rpm <1> |
| 63 | +---- |
| 64 | +<1> The `*` represents the date and commit ID. Your output should contain both, for example `-202311101230.p0.g7dc6a00.assembly.4.14.0`. |
| 65 | + |
| 66 | +.. Unpack the RPM package without installing it by running the following command: |
| 67 | ++ |
| 68 | +[source,terminal] |
| 69 | +---- |
| 70 | +$ rpm2cpio <my_microshift_release_info> | cpio -idmv <1> |
| 71 | +./usr/share/microshift/release/release-aarch64.json |
| 72 | +./usr/share/microshift/release/release-x86_64.json |
| 73 | +---- |
| 74 | +<1> Replace `<my_microshift_release_info>` with the name of the RPM package from the previous step. |
| 75 | + |
| 76 | +. Define the location of your JSON file, which contains the container reference information, by running the following command: |
| 77 | ++ |
| 78 | +[source,terminal] |
| 79 | +---- |
| 80 | +$ RELEASE_FILE=</path/to/your/release-$(uname -m).json> |
| 81 | +---- |
| 82 | +Replace `</path/to/your/release-$(uname -m).json>` with the full path to your JSON file. Be sure to use the file needed for your architecture. |
| 83 | + |
| 84 | +. Define the location of your TOML file, which contains instructions for building the image, by running the following command: |
| 85 | ++ |
| 86 | +[source,terminal] |
| 87 | +---- |
| 88 | +$ BLUEPRINT_FILE=</path/to/your/blueprint.toml> |
| 89 | +---- |
| 90 | +Replace `</path/to/your/blueprint.toml>` with the full path to your JSON file. |
| 91 | + |
| 92 | +. Generate and then embed the container image references in your blueprint TOML file by running the following command: |
| 93 | ++ |
| 94 | +[source,terminal] |
| 95 | +---- |
| 96 | +$ jq -r '.images | .[] | ("[[containers]]\nsource = \"" + . + "\"\n")' "${RELEASE_FILE}" >> "${BLUEPRINT_FILE}" |
| 97 | +---- |
| 98 | ++ |
| 99 | +.Example resulting `<my_blueprint.toml>` fragment showing container references |
| 100 | +[source,terminal] |
| 101 | +---- |
| 102 | +[[containers]] |
| 103 | +source = "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:82cfef91557f9a70cff5a90accba45841a37524e9b93f98a97b20f6b2b69e5db" |
| 104 | +
|
| 105 | +[[containers]] |
| 106 | +source = "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:82cfef91557f9a70cff5a90accba45841a37524e9b93f98a97b20f6b2b69e5db" |
| 107 | +---- |
| 108 | + |
| 109 | +. You can manually embed any container image by adding it to the Image Builder blueprint using the following example: |
| 110 | ++ |
| 111 | +.Example section for manually embedding container image to Image Builder |
| 112 | +[source,terminal] |
| 113 | +---- |
| 114 | +[[containers]] |
| 115 | +source = "<my_image_pullspec_with_tag_or_digest>" |
| 116 | +---- |
| 117 | +Replace `<my_image_pullspec_with_tag_or_digest>` with the exact reference to a container image used by the {microshift-short} version you are deploying. |
0 commit comments