1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00

OSDOCS-44921: simplify mirrring docs MicroShift

This commit is contained in:
“Shauna Diaz”
2025-02-06 12:55:58 -05:00
committed by openshift-cherrypick-robot
parent eb5869b5d1
commit 224169c448
7 changed files with 21 additions and 59 deletions

View File

@@ -1,6 +1,6 @@
// Module included in the following assemblies:
//
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
:_mod-docs-content-type: PROCEDURE
[id="microshift-configuring-hosts-for-mirror_{context}"]

View File

@@ -1,6 +1,6 @@
// Module included in the following assemblies:
//
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
:_mod-docs-content-type: PROCEDURE
[id="microshift-downloading-container-images_{context}"]
@@ -11,7 +11,7 @@ After you have located the container list and completed the mirroring prerequisi
.Prerequisites
* You are logged into a host with access to the internet.
* You have ensured that the `.pull-secret-mirror.json` file and `microshift-containers` directory contents are available locally.
* The `.pull-secret-mirror.json` file and `microshift-containers` directory contents are available locally.
.Procedure
@@ -61,5 +61,3 @@ while read -r src_img ; do
done < "${IMAGE_LIST_FILE}"
----
. Transfer the image set to the target environment, such as air-gapped site. Then you can upload the image set into the mirror registry.

View File

@@ -1,6 +1,6 @@
// Module included in the following assemblies:
//
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
:_mod-docs-content-type: PROCEDURE
[id="microshift-get-mirror-reg-container-image-list_{context}"]

View File

@@ -1,6 +1,6 @@
// Module included in the following assemblies:
//
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
:_mod-docs-content-type: CONCEPT
[id="microshift-mirror-container-images_{context}"]

View File

@@ -1,6 +1,6 @@
// Module included in the following assemblies:
//
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
:_mod-docs-content-type: CONCEPT
[id="microshift-configuring-mirroring-prereqs_{context}"]

View File

@@ -1,27 +0,0 @@
[source,sh]
----
# Use timestamp and counter as a tag on the target images to avoid
# their overwrite by the 'latest' automatic tagging
image_tag=mirror-$(date +%y%m%d%H%M%S)
image_cnt=1
pushd "${IMAGE_LOCAL_DIR}" >/dev/null
while read -r src_manifest ; do
# Remove the manifest.json file name
src_img=$(dirname "${src_manifest}")
# Add the target registry prefix and remove SHA
dst_img="${TARGET_REGISTRY}/${src_img}"
dst_img=$(echo "${dst_img}" | awk -F'@' '{print $1}')
# Run the image upload command
echo "Uploading '${src_img}' to '${dst_img}'"
skopeo copy --all --quiet \
--preserve-digests \
--authfile "${IMAGE_PULL_FILE}" \
dir://"${IMAGE_LOCAL_DIR}/${src_img}" docker://"${dst_img}:${image_tag}-${image_cnt}"
# Increment the counter
(( image_cnt += 1 ))
done < <(find . -type f -name manifest.json -printf '%P\n')
popd >/dev/null
----

View File

@@ -1,6 +1,6 @@
// Module included in the following assemblies:
//
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
// * microshift/pmicroshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
:_mod-docs-content-type: PROCEDURE
[id="microshift-uploading-container-images-to-mirror_{context}"]
@@ -39,38 +39,29 @@ $ IMAGE_LOCAL_DIR=~/microshift-containers
. Set the environment variables pointing to the mirror registry URL for uploading the container images:
+
[source,terminal]
[source,terminal,subs="+quotes"]
----
$ TARGET_REGISTRY=<registry_host>:<port> <1>
$ TARGET_REGISTRY=_<registry_host>:<port>_ # <1>
----
<1> Replace `<registry_host>:<port>` with the host name and port of your mirror registry server.
<1> Replace `_<registry_host>:<port>_` with the host name and port of your mirror registry server.
. Run the following script to upload the container images to the `${TARGET_REGISTRY}` mirror registry:
+
[source,terminal]
----
image_tag=mirror-$(date +%y%m%d%H%M%S)
image_cnt=1
# Uses timestamp and counter as a tag on the target images to avoid
# their overwrite by the 'latest' automatic tagging
pushd "${IMAGE_LOCAL_DIR}" >/dev/null
while read -r src_manifest ; do
# Remove the manifest.json file name
src_img=$(dirname "${src_manifest}")
# Add the target registry prefix and remove SHA
dst_img="${TARGET_REGISTRY}/${src_img}"
dst_img=$(echo "${dst_img}" | awk -F'@' '{print $1}')
# Run the image upload command
echo "Uploading '${src_img}' to '${dst_img}'"
skopeo copy --all --quiet \
--preserve-digests \
--authfile "${IMAGE_PULL_FILE}" \
dir://"${IMAGE_LOCAL_DIR}/${src_img}" docker://"${dst_img}:${image_tag}-${image_cnt}"
# Increment the counter
(( image_cnt += 1 ))
local src_img
src_img=$(dirname "${src_manifest}")
# Add the target registry prefix and remove SHA
local -r dst_img="${TARGET_REGISTRY}/${src_img}"
local -r dst_img_no_tag="${TARGET_REGISTRY}/${src_img%%[@:]*}"
# Run the image upload
echo "Uploading '${src_img}' to '${dst_img}'"
skopeo copy --all --quiet \
--preserve-digests \
--authfile "${IMAGE_PULL_FILE}" \
dir://"${IMAGE_LOCAL_DIR}/${src_img}" docker://"${dst_img}"
done < <(find . -type f -name manifest.json -printf '%P\n')
popd >/dev/null
----