|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * installing/installing-mirroring-installation-images.adoc |
| 4 | + |
| 5 | +ifdef::openshift-origin[] |
| 6 | +:index-image-pullspec: quay.io/operatorhubio/catalog:latest |
| 7 | +endif::[] |
| 8 | +ifndef::openshift-origin[] |
| 9 | +:index-image-pullspec: registry.redhat.io/redhat/redhat-operator-index:v{product-version} |
| 10 | +endif::[] |
| 11 | + |
| 12 | +[id="olm-mirror-catalog-airgapped_{context}"] |
| 13 | += Mirroring catalog contents to airgapped registries |
| 14 | + |
| 15 | +If your mirror registry is on a completely disconnected, or airgapped, host, take the following actions. |
| 16 | + |
| 17 | +.Procedure |
| 18 | + |
| 19 | +. Run the following command on your workstation with unrestricted network access to mirror the content to local files: |
| 20 | ++ |
| 21 | +[source,terminal] |
| 22 | +---- |
| 23 | +$ oc adm catalog mirror \ |
| 24 | + <index_image> \ <.> |
| 25 | + file:///local/index \ <.> |
| 26 | + -a ${REG_CREDS} \ <.> |
| 27 | + --insecure \ <.> |
| 28 | + --index-filter-by-os='<platform>/<arch>' <.> |
| 29 | +---- |
| 30 | +<.> Specify the index image for the catalog that you want to mirror. For example, this might be a pruned index image that you created previously, or one of the source index images for the default catalogs, such as `{index-image-pullspec}`. |
| 31 | +<.> Specify the content to mirror to local files in your current directory. |
| 32 | +<.> Optional: If required, specify the location of your registry credentials file. |
| 33 | +<.> Optional: If you do not want to configure trust for the target registry, add the `--insecure` flag. |
| 34 | +<.> Optional: Specify which platform and architecture of the index image to select when multiple variants are available. Images are specified as `'<platform>/<arch>[/<variant>]'`. This does not apply to images referenced by the index. Valid values are `linux/amd64`, `linux/ppc64le`, `linux/s390x`, and `.*` |
| 35 | ++ |
| 36 | +.Example output |
| 37 | +[source,terminal] |
| 38 | +---- |
| 39 | +... |
| 40 | +info: Mirroring completed in 5.93s (5.915MB/s) |
| 41 | +wrote mirroring manifests to manifests-my-index-1614985528 <1> |
| 42 | +
|
| 43 | +To upload local images to a registry, run: |
| 44 | +
|
| 45 | + oc adm catalog mirror file://local/index/myrepo/my-index:v1 REGISTRY/REPOSITORY <2> |
| 46 | +---- |
| 47 | +<1> Record the manifests directory name that is generated. This directory is referenced in subsequent procedures. |
| 48 | +<2> Record the expanded `file://` path that is based on your provided index image. This path is referenced in a subsequent step. |
| 49 | ++ |
| 50 | +This command creates a `v2/` directory in your current directory. |
| 51 | + |
| 52 | +. Copy the `v2/` directory to removable media. |
| 53 | + |
| 54 | +. Physically remove the media and attach it to a host in the disconnected environment that has access to the mirror registry. |
| 55 | + |
| 56 | +. If your mirror registry requires authentication, run the following command on your host in the disconnected environment to log in to the registry: |
| 57 | ++ |
| 58 | +[source,terminal] |
| 59 | +---- |
| 60 | +$ podman login <mirror_registry> |
| 61 | +---- |
| 62 | + |
| 63 | +. Run the following command from the parent directory containing the `v2/` directory to upload the images from local files to the mirror registry: |
| 64 | ++ |
| 65 | +[source,terminal] |
| 66 | +---- |
| 67 | +$ oc adm catalog mirror \ |
| 68 | + file://local/index/<repo>/<index_image>:<tag> \ <.> |
| 69 | + <mirror_registry>:<port>/<namespace> \ <.> |
| 70 | + -a ${REG_CREDS} \ <.> |
| 71 | + --insecure \ <.> |
| 72 | + --index-filter-by-os='<platform>/<arch>' <.> |
| 73 | +---- |
| 74 | +<.> Specify the `file://` path from the previous command output. |
| 75 | +<.> Specify the target registry and namespace to mirror the Operator contents to, where `<namespace>` is any existing namespace on the registry. For example, you might create an `olm-mirror` namespace to push all mirrored content to. |
| 76 | +<.> Optional: If required, specify the location of your registry credentials file. |
| 77 | +<.> Optional: If you do not want to configure trust for the target registry, add the `--insecure` flag. |
| 78 | +<.> Optional: Specify which platform and architecture of the index image to select when multiple variants are available. Images are specified as `'<platform>/<arch>[/<variant>]'`. This does not apply to images referenced by the index. Valid values are `linux/amd64`, `linux/ppc64le`, `linux/s390x`, and `.*` |
| 79 | ++ |
| 80 | +[NOTE] |
| 81 | +==== |
| 82 | +Red Hat Quay does not support nested repositories. As a result, running the `oc adm catalog mirror` command will fail with a `401` unauthorized error. As a workaround, you can use the `--max-components=2` option when running the `oc adm catalog mirror` command to disable the creation of nested repositories. For more information on this workaround, see the link:https://access.redhat.com/solutions/5440741[Unauthorized error thrown while using catalog mirror command with Quay registry] Knowledgebase Solution. |
| 83 | +==== |
| 84 | + |
| 85 | +After you mirror the catalog, you can continue with the remainder of your cluster installation. After your cluster installation has finished successfully, you must specify the manifests directory from this procedure to create the `ImageContentSourcePolicy` and `CatalogSource` objects. These objects are required to enable installation of Operators from OperatorHub. |
| 86 | + |
| 87 | +:!index-image-pullspec: |
0 commit comments