Prerequisites to install Operator in airgap

The prerequisites for installing with or without OLM in airgap are the same. Begin by downloading the Operator case, logging in to the necessary repositories, and mirroring the container images

Before you begin

  1. Install the yq command-line Yaml processor. For more information, see yq usage guide.
  2. Install any of the container tools- Docker or Podman. For more information, see Docker and Podman.
  3. Install skopeo, a utility to perform various operations on container images and image repositories. For more information, see skopeo.
  4. A local registry to store the mirrored images.

About this task

The following steps 2 and 3 use skopeo commands, however you can use either of Docker, Podman, or skopeo commands.

Procedure

  1. Download and extract the case.
    1. Set the CASE_VERSION of the Operator that you want to install. For EDITION, use ent for Enterprise and pro for Professional.
      export CASE_VERSION="3.0.26"
      export EDITION="ent"
    2. Download the case.
      curl -O https://raw.githubusercontent.com/IBM/cloud-pak/master/repo/case/ibm-oms-$EDITION-case/$CASE_VERSION/ibm-oms-$EDITION-case-$CASE_VERSION.tgz
      
    3. Extract the case.
      tar -xzf ibm-oms-$EDITION-case-$CASE_VERSION.tgz 
  2. Log in to source and target repositories to mirror the images.
    1. To authenticate with the entitled registry and enable image pulls, run the following command.
      skopeo login icr.io
    2. If your local registry requires authentication to push images, use the following command. Replace your-local-registry with the URL of your local registry.
      skopeo login your-local-registry
  3. Mirror the container images by using the following commands. Replace EDITION and TARGET_REPO with the edition and the repository that you want.
    The container images are retrieved from the source registry and uploaded to your local registry to enable offline installation.
    export TARGET_REPO="docker.io/my_username/my_repo"
    export EDITION="ent"
    export SOURCE_REPO="icr.io"
    export CAP_EDITION=$(echo "$EDITION" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}')
    export OP_CASE_INVENTORY="ibm-oms-${EDITION}-case/inventory/ibmOms${CAP_EDITION}ProdSetup"
    export APP_CASE_INVENTORY="ibm-oms-${EDITION}-case/inventory/ibmOms${CAP_EDITION}Prod"
    export CASE_INVENTORIES=("$OP_CASE_INVENTORY" "$APP_CASE_INVENTORY")
    
    echo "Mirroring images from $SOURCE_REPO to $TARGET_REPO..."
    for INVENTORY in "${CASE_INVENTORIES[@]}"; do
      echo -e "\nProcessing inventory: $INVENTORY"
      IMAGES_AND_TAGS=$(
        yq e '
        .resources.resourceDefs.containerImages[].image
        + ":"
        + .resources.resourceDefs.containerImages[].tag
        ' $APP_CASE_INVENTORY/resources.yaml
      )
      while IFS= read -r img; do
        tgt_img_and_tag=$(echo "$img" | awk -F'/' '{print $NF}')
        echo "Copy $SOURCE_REPO/$img to $TARGET_REPO/$tgt_img_and_tag"
        skopeo copy --all --remove-signatures \
               docker://$SOURCE_REPO/$img \
               docker://$TARGET_REPO/$tgt_img_and_tag
      done <<< "$IMAGES_AND_TAGS"
    done