Mirroring Red Hat operator images to enterprise registry
Mirror the Red Hat® operator images to your enterprise registry.
Before you begin
Procedure
- Run the following command to login to Docker registry with your Red Hat enterprise credentials:
docker login registry.redhat.io -u <Red Hat enterprise registry username> -p <Red Hat enterprise registry password>Set the following environment variables:export LOCAL_SECRET_JSON='<relative path to pull-secret.json>' export LOCAL_ISF_REGISTRY="<Your enterprise registry host>:<port>" export LOCAL_ISF_REPOSITORY="<Your image path>" IFS='/' read -r NAMESPACE PREFIX <<< "$LOCAL_ISF_REPOSITORY" if [[ "$PREFIX" != "" ]]; then export TARGET_PATH="$LOCAL_ISF_REGISTRY/$NAMESPACE/$PREFIX"; export REPO_PREFIX=$(echo "$PREFIX"| sed -r 's/\//-/g')-; export NAMESPACE="$NAMESPACE"; else export TARGET_PATH="$LOCAL_ISF_REGISTRY/$NAMESPACE"; export REPO_PREFIX=""; fi #verify both variables set correctly echo "$TARGET_PATH" echo "$NAMESPACE" echo "$REPO_PREFIX"Note: Port is a non-mandatory value when setting theLOCAL_ISF_REGISTRYvariable. You can ignore this if your enterprise registry is accessible and has a secure connection.Sample value for without port:export LOCAL_ISF_REGISTRY="registryhost.com"See the following sample values:export LOCAL_SECRET_JSON='/home/mirror/pull-secret.json' export LOCAL_ISF_REGISTRY="registryhost.com:443" export LOCAL_ISF_REPOSITORY="fusion-mirror"LOCAL_SECRET_JSONis relative path for yourpull-secret.jsonfile.LOCAL_ISF_REGISTRYis your entitlement registry.LOCAL_ISF_REPOSITORYis the image path in which you want to mirror the images. You can choose your own repository paths. For example, hci-2.6.1/isf or hci-2.6.1. - Run the command to login to the Docker registry with your enterprise registry
credentials.
docker login $LOCAL_ISF_REGISTRY -u <your enterprise registry username> -p <your enterprise registry password> - If you have docker, run the following
opmindex prune command to create a new index image that contains necessary packages:opm index prune -f registry.redhat.io/redhat/redhat-operator-index:v4.10 -p kubernetes-nmstate-operator,kubevirt-hyperconverged,redhat-oadp-operator,amq-streams -t "$TARGET_PATH"/redhat-operator-index:v4.10 -c dockerNote:- The redhat-oadp-operator and amq-streams packages are required to install the Red Hat OADP operator and AMQ Streams operator. It is a prerequisite to deploy the IBM Backup & Restore service. If you plan to use the IBM Backup & Restore service, retain it in the commands, or else you can skip it.
- If you have podman instead of docker, use the following
command.
opm index prune -f registry.redhat.io/redhat/redhat-operator-index:v4.10 -p kubernetes-nmstate-operator,kubevirt-hyperconverged,redhat-oadp-operator,amq-streams -t "$TARGET_PATH"/redhat-operator-index:v4.10
This can take 5 - 10 minutes to complete.Note: Thekubevirt-hyperconvergedis required to install OpenShift® virtualization operator. It is a prerequisite to deployisf-ics operator. If you plan to useisf-ics, retain it in the commands, or else you can skip it.The created index package haskubernetes-nmstate-operatorandkubevirt-hyperconvergedoperator images. - Run the command to push the created image to enterprise registry:
docker push "$TARGET_PATH"/redhat-operator-index:v4.10 - Run the command to create catalog mirror
image:
You can monitor the status in the generatednohup oc adm catalog mirror -a "$LOCAL_SECRET_JSON" "$TARGET_PATH"/redhat-operator-index:v4.10 "$TARGET_PATH" --index-filter-by-os='linux/amd64' &nohup.out.wrote mirroring manifests to manifests-<index_image_name>-<random_number> - After successfully mirroring the content to your registry, check the manifests directory
that is created in your current directory. Ensure that the directory name has the following form and
the generated folder should contain the following three files:
manifests-<index_image_name>-<random_number> catalogSource.yaml imageContentSourcePolicy.yaml mapping.txtFor example see the following folder and files generated in your current directory:ls manifests-redhat-operator-index-123456789 catalogSource.yaml imageContentSourcePolicy.yaml mapping.txt