Mirroring operator images

IMPORTANT:

This procedure is only applicable if the mode of installation is offline.

When OpenShift Container Platform is installed on disconnected or offline mode, Operator Lifecycle Manager (OLM) can no longer use the default OperatorHub sources because they require full Internet connectivity. Cluster administrators can disable those default sources and create local mirrors so that OLM can install and manage Operators from the local sources instead.

Prerequisites
  • Ensure that the private registry is configured

  • 150 GB space must be available in the registry server

  • Ensure that Python 3 is installed

Procedure
  1. Navigate to the following directory:
    cd /root/nps-rhocp/registry-utils/standalone-scripts
  2. Fill the arguments.json file with the correct details.
    {
            "registry_hostname": "<registry FQDN>",
            "registry_port": "<registry-port>",
            "registry_username": "<registry-username>",
            "registry_password": "<registry-password>",
            "rh_account_username": "<RH Customer portal login user name>",
            "rh_account_password": "<RH Customer portal login password>",
            "exclude_is": "['jenkins-agent-nodejs','jenkins','jenkins-agent-maven']",
            "kubeconfig": "",
            "ca_cert": "<path to registry ca-cert>",
            "cleanup": "yes",
            "tag": "4.3"
    }
    
    NOTE:

    Initially, during the mirroring process of operator images, the kubeconfig parameter must be kept empty.

    For the detailed description of the parameters, see Parameter descriptions in arguments.json file.

  3. Run the following command to mirror operators in the local registry:
    nohup python3 -u redhat-operator.py &
  4. To check the progress and status, tail the nohup.out file in the same directory.
    tail -f nohup.out
  5. To verify that the image is installed in the registry server.
    This redhat-operator.py script creates a redhat-operators-manifests directory in the current directory from where the script is executed and generates the following files:
    • The imageContentSourcePolicy.yaml file defines the ImageContentSourcePolicy object that can configure nodes to translate between the image references stored in the Operator manifests and the mirrored registry.

    • The mapping.txt file contains all the source images and where to map them in the target registry. This file is compatible with the oc image mirror command and can be used to further customize the mirroring configuration.