Pushing images to a single namespace in an air-gapped environment

Symptom

When installing IBM Cloud Pak foundational services in an air-gapped environment, one user is allowed to push an image only to a single namespace. Because of that, the installation procedure cannot be completed. For more information, see Installing IBM Cloud Pak foundational services in an air-gapped environment.

Cause

The installation procedure assumes that the user can push images to multiple namespaces.

Solution

Complete the following steps to install IBM Cloud Pak foundational services in an air-gapped environment when one user is allowed to push an image to a single namespace only.

  1. Use the following command to download the cases.
oc ibm-pak case save --repo $CASE_REPO_PATH --case $CASE_NAME --version $CASE_VERSION --outputdir $OFFLINEDIR
  1. Use the following command to configure your air-gap credentials for the first user.
oc ibm-pak case launch --case $OFFLINEDIR/$CASE_ARCHIVE --inventory $CASE_INVENTORY_SETUP --action configure-creds-airgap --args "--registry quay-etaps.registry.intern --user cpopen+robot --pass …"
  1. Unpack the case.

    1. Use the following command to unpack the case.

      tar xzvf ibm-cp-common-services-4.1.0.tgz
      

      as a workaround to: https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=1874106 3b) vi inventory/ibmCommonServiceOperatorSetup/files/airgap.sh (add --skip-multiple-scopes=true to oc_mirror_images function)

    2. Get the cpopen images only.

      head -n 1 ibm-cp-common-services-4.1.0-images.csv > ibm-cp-common-services-4.1.0-images.csv.cpopen && cat ibm-cp-common-services-4.1.0-images.csv | grep cpopen >> ibm-cp-common-services-4.1.0-images.csv.cpopen
      
    3. Move all the .csv files out of case folder.

    4. Move the .csv files back to the original location.

    5. Run the following command to add tolerance for the modified case.

      oc ibm-pak case launch  --case $OFFLINEDIR/ibm-cp-common-services  --inventory $CASE_INVENTORY_SETUP  --action mirror-images  --args "--registry quay-etaps.registry.intern --inputDir $OFFLINEDIR" --tolerance 1 --tls
      
  2. Use the following command to configure your air-gap credentials for the second user.

oc ibm-pak case launch --case $OFFLINEDIR/$CASE_ARCHIVE --inventory $CASE_INVENTORY_SETUP --action configure-creds-airgap --args "--registry quay-etaps.registry.intern --user opencloudio+robot --pass …"
  1. Get the cpopen images only.
head -n 1 ibm-cp-common-services-4.1.0-images.csv > ibm-cp-common-services-4.1.0-images.csv.opencloudio && cat ibm-cp-common-services-1.5.0-images.csv | grep opencloudio >> ibm-cp-common-services-4.1.0-images.csv.opencloudio
  1. Keep only the ibm-licensing-4.1.0-images.csv and ibm-cp-common-services-4.1.0-images.csv.opencloudio. Move the remaining .csv. files out of the case folder.
mv ibm-cp-common-services-4.1.0-images.csv.opencloudio ibm-cp-common-services-4.1.0-images.csv
  1. Mirror the images.
oc ibm-pak case launch  --case $OFFLINEDIR/ibm-cp-common-services  --inventory $CASE_INVENTORY_SETUP  --action mirror-images  --args "--registry quay-etaps.registry.intern --inputDir $OFFLINEDIR" --tolerance 1 --tls
  1. Change the images to public visibility in Quay.

  2. Run the following commands to complete the installation.

oc login as cluster admin
oc create namespace $NAMESPACE
oc ibm-pak case launch --case $OFFLINEDIR/$CASE_ARCHIVE --inventory $CASE_INVENTORY_SETUP --action configure-cluster-airgap --namespace $NAMESPACE --args "--registry quay-etaps.registry.intern --user opencloudio+robot --pass ... --inputDir $OFFLINEDIR"
oc ibm-pak case launch --case $OFFLINEDIR/$CASE_ARCHIVE --inventory $CASE_INVENTORY_SETUP --action install-catalog --namespace $NAMESPACE --args "--registry quay-etaps.registry.intern"
oc apply -f yaml/subscription.yaml
oc apply -f yaml/operandrequest.yaml