Skip to content

Commit 4b457d8

Browse files
authored
Merge pull request #36727 from adellape/mv_olm_disconnected
2 parents a424f4b + 3fc3ece commit 4b457d8

14 files changed

+329
-222
lines changed

installing/installing-mirroring-installation-images.adoc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,32 @@ In a disconnected environment, you must take additional steps after you install
7373

7474
include::modules/installation-images-samples-disconnected-mirroring-assist.adoc[leveloffset=+2]
7575

76+
include::modules/olm-mirroring-catalog.adoc[leveloffset=+1]
77+
.Additional resources
7678

79+
* xref:../operators/admin/olm-restricted-networks.adoc#olm-restricted-networks[Using Operator Lifecycle Manager on restricted networks]
80+
81+
include::modules/olm-mirroring-catalog-prereqs.adoc[leveloffset=+2]
82+
include::modules/olm-mirroring-catalog-extracting.adoc[leveloffset=+2]
83+
include::modules/olm-mirroring-catalog-colocated.adoc[leveloffset=+3]
84+
.Additional resources
85+
* xref:../operators/operator_sdk/osdk-generating-csvs.adoc#olm-arch-os-support_osdk-generating-csvs[Architecture and operating system support for Operators]
86+
87+
include::modules/olm-mirroring-catalog-airgapped.adoc[leveloffset=+3]
88+
.Additional resources
89+
* xref:../operators/operator_sdk/osdk-generating-csvs.adoc#olm-arch-os-support_osdk-generating-csvs[Architecture and operating system support for Operators]
90+
91+
include::modules/olm-mirroring-catalog-manifests.adoc[leveloffset=+2]
92+
include::modules/olm-mirroring-catalog-post.adoc[leveloffset=+2]
93+
.Additional resources
94+
95+
* xref:../post_installation_configuration/preparing-for-users.adoc#post-install-mirrored-catalogs[Populating OperatorHub from mirrored Operator catalogs]
96+
97+
[id="next-steps_installing-mirroring-installation-images"]
7798
== Next steps
7899

79100
//* TODO need to add the registry secret to the machines, which is different
80101

81-
* xref:../operators/admin/olm-restricted-networks.adoc#olm-mirror-catalog_olm-restricted-networks[Mirror] the OperatorHub images for the Operators that you want to install in your cluster.
82102
* Install a cluster on infrastructure that you provision in your restricted network, such as on
83103
xref:../installing/installing_vsphere/installing-restricted-networks-vsphere.adoc#installing-restricted-networks-vsphere[VMware vSphere],
84104
xref:../installing/installing_bare_metal/installing-restricted-networks-bare-metal.adoc#installing-restricted-networks-bare-metal[bare metal], or xref:../installing/installing_aws/installing-restricted-networks-aws.adoc#installing-restricted-networks-aws[Amazon Web Services].

modules/olm-catalogsource.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ endif::[]
1212
[id="olm-catalogsource_{context}"]
1313
= Catalog source
1414

15-
A _catalog source_ represents a store of metadata, typically by referencing an _index image_ stored in a container registry. Operator Lifecycle Manager (OLM) queries catalog sources to discover and install Operators and their dependencies. The OperatorHub in the {product-title} web console also displays the Operators provided by catalog sources.
15+
A _catalog source_ represents a store of metadata, typically by referencing an _index image_ stored in a container registry. Operator Lifecycle Manager (OLM) queries catalog sources to discover and install Operators and their dependencies. OperatorHub in the {product-title} web console also displays the Operators provided by catalog sources.
1616

1717
[TIP]
1818
====

modules/olm-creating-catalog-from-index.adoc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Module included in the following assemblies:
22
//
3+
// * post_installation_configuration/preparing-for-users.adoc
34
// * operators/admin/olm-restricted-networks.adoc
45
// * operators/admin/managing-custom-catalogs.adoc
56

@@ -13,14 +14,17 @@ ifndef::openshift-origin[]
1314
:tag: v{product-version}
1415
:namespace: openshift-marketplace
1516
endif::[]
17+
ifeval::["{context}" == "post-install-preparing-for-users"]
18+
:olm-restricted-networks:
19+
endif::[]
1620
ifeval::["{context}" == "olm-restricted-networks"]
1721
:olm-restricted-networks:
1822
endif::[]
1923

2024
[id="olm-creating-catalog-from-index_{context}"]
21-
= Creating a catalog from an index image
25+
= Adding a catalog source to a cluster
2226

23-
You can create an Operator catalog from an index image and apply it to an {product-title} cluster for use with Operator Lifecycle Manager (OLM).
27+
Adding a catalog source to an {product-title} cluster enables the discovery and installation of Operators for users. Cluster administrators can create a `CatalogSource` object that references an index image. OperatorHub uses catalog sources to populate the user interface.
2428

2529
.Prerequisites
2630

@@ -30,7 +34,7 @@ You can create an Operator catalog from an index image and apply it to an {produ
3034

3135
. Create a `CatalogSource` object that references your index image.
3236
ifdef::olm-restricted-networks[]
33-
If you used the `oc adm catalog mirror` command to mirror your catalog to a target registry, you can use the generated `catalogSource.yaml` file as a starting point.
37+
If you used the `oc adm catalog mirror` command to mirror your catalog to a target registry, you can use the generated `catalogSource.yaml` file in your manifests directory as a starting point.
3438
endif::[]
3539

3640
.. Modify the following to your specifications and save it as a `catalogSource.yaml` file:
@@ -134,6 +138,9 @@ You can now install the Operators from the *OperatorHub* page on your {product-t
134138
:!index-image:
135139
:!tag:
136140
:!namespace:
141+
ifeval::["{context}" == "post-install-preparing-for-users"]
142+
:!olm-restricted-networks:
143+
endif::[]
137144
ifeval::["{context}" == "olm-restricted-networks"]
138145
:!olm-restricted-networks:
139146
endif::[]
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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:
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
:index-image: catalog
8+
endif::[]
9+
ifndef::openshift-origin[]
10+
:index-image-pullspec: registry.redhat.io/redhat/redhat-operator-index:v{product-version}
11+
:index-image: redhat-operator-index
12+
endif::[]
13+
14+
[id="olm-mirror-catalog-colocated_{context}"]
15+
= Mirroring catalog contents to registries on the same network
16+
17+
If your mirror registry is co-located on the same network as your workstation with unrestricted network access, take the following actions on your workstation.
18+
19+
.Procedure
20+
21+
. If your mirror registry requires authentication, run the following command to log in to the registry:
22+
+
23+
[source,terminal]
24+
----
25+
$ podman login <mirror_registry>
26+
----
27+
28+
. Run the following command to extract and mirror the content to the mirror registry:
29+
+
30+
[source,terminal]
31+
----
32+
$ oc adm catalog mirror \
33+
<index_image> \ <.>
34+
<mirror_registry>:<port>/<namespace> \ <.>
35+
[-a ${REG_CREDS}] \ <.>
36+
[--insecure] \ <.>
37+
[--index-filter-by-os='<platform>/<arch>'] \ <.>
38+
[--manifests-only] <.>
39+
----
40+
<1> 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}`.
41+
<2> 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.
42+
<3> Optional: If required, specify the location of your registry credentials file.
43+
<4> Optional: If you do not want to configure trust for the target registry, add the `--insecure` flag.
44+
<5> Optional: Specify which platform and architecture of the index image to select when multiple variants are available. Images are passed as `'<platform>/<arch>[/<variant>]'`. This does not apply to images referenced by the index. Valid values are `linux/amd64`, `linux/ppc64le`, `linux/s390x`, and `.*`
45+
<6> Optional: Generate only the manifests required for mirroring, and do not actually mirror the image content to a registry. This option can be useful for reviewing what will be mirrored, and it allows you to make any changes to the mapping list if you require only a subset of packages. You can then use the `mapping.txt` file with the `oc image mirror` command to mirror the modified list of images in a later step. This flag is intended for only advanced selective mirroring of content from the catalog; the `opm index prune` command, if you used it previously to prune the index image, is suitable for most catalog management use cases.
46+
+
47+
.Example output
48+
[source,terminal,subs="attributes+"]
49+
----
50+
src image has index label for database path: /database/index.db
51+
using database path mapping: /database/index.db:/tmp/153048078
52+
wrote database to /tmp/153048078 <1>
53+
...
54+
wrote mirroring manifests to manifests-{index-image}-1614211642 <2>
55+
----
56+
<1> Directory for the temporary `index.db` database generated by the command.
57+
<2> Record the manifests directory name that is generated. This directory is referenced in subsequent procedures.
58+
+
59+
[NOTE]
60+
====
61+
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.
62+
====
63+
64+
:!index-image-pullspec:
65+
:!index-image:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * installing/installing-mirroring-installation-images.adoc
4+
5+
[id="olm-mirror-catalog-extracting_{context}"]
6+
= Extracting and mirroring catalog contents
7+
8+
The `oc adm catalog mirror` command extracts the contents of an index image to generate the manifests required for mirroring. The default behavior of the command generates manifests, then automatically mirrors all of the image content from the index image, as well as the index image itself, to your mirror registry.
9+
10+
Alternatively, if your mirror registry is on a completely disconnected, or _airgapped_, host, you can first mirror the content to removable media, move the media to the disconnected environment, then mirror the content from the media to the registry.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * post_installation_configuration/preparing-for-users.adoc
4+
5+
[id="olm-mirror-catalog-icsp_{context}"]
6+
= Creating the ImageContentSourcePolicy object
7+
8+
After mirroring Operator catalog content to your mirror registry, create the required `ImageContentSourcePolicy` (ICSP) object. The ICSP object configures nodes to translate between the image references stored in Operator manifests and the mirrored registry.
9+
10+
.Procedure
11+
12+
* On a host with access to the disconnected cluster, create the ICSP by running the following command to specify the `imageContentSourcePolicy.yaml` file in your manifests directory:
13+
+
14+
[source,terminal,subs="attributes+"]
15+
----
16+
$ oc create -f <path/to/manifests/dir>/imageContentSourcePolicy.yaml
17+
----
18+
+
19+
where `<path/to/manifests/dir>` is the path to the manifests directory for your mirrored content.
20+
+
21+
[NOTE]
22+
====
23+
Applying the ICSP causes all worker nodes in the cluster to restart. You must wait for this reboot process to finish cycling through each of your worker nodes before proceeding.
24+
====
25+
26+
You can now create a `CatalogSource` object to reference your mirrored index image and Operator content.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * installing/installing-mirroring-installation-images.adoc
4+
5+
[id="olm-mirror-catalog-manifests_{context}"]
6+
= Generated manifests
7+
8+
After mirroring Operator catalog content to your mirror registry, a manifests directory is generated in your current directory.
9+
10+
If you mirrored content to a registry on the same network, the directory name takes the following pattern:
11+
12+
[source,text]
13+
----
14+
manifests-<index_image_name>-<random_number>
15+
----
16+
17+
If you mirrored content to a registry on a disconnected host in the previous section, the directory name takes the following pattern:
18+
19+
[source,text]
20+
----
21+
manifests-index/<namespace>/<index_image_name>-<random_number>
22+
----
23+
24+
[NOTE]
25+
====
26+
The manifests directory name is referenced in subsequent procedures.
27+
====
28+
29+
The manifests directory contains the following files, some of which might require further modification:
30+
31+
* The `catalogSource.yaml` file is a basic definition for a `CatalogSource` object that is pre-populated with your index image tag and other relevant metadata. This file can be used as is or modified to add the catalog source to your cluster.
32+
+
33+
[IMPORTANT]
34+
====
35+
If you mirrored the content to local files, you must modify your `catalogSource.yaml` file to remove any backslash (`/`) characters from the `metadata.name` field. Otherwise, when you attempt to create the object, it fails with an "invalid resource name" error.
36+
====
37+
* The `imageContentSourcePolicy.yaml` file defines an `ImageContentSourcePolicy` object that can configure nodes to translate between the image references stored in Operator manifests and the mirrored registry.
38+
+
39+
[NOTE]
40+
====
41+
If your cluster uses an `ImageContentSourcePolicy` object to configure repository mirroring, you can use only global pull secrets for mirrored registries. You cannot add a pull secret to a project.
42+
====
43+
* The `mapping.txt` file contains all of 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.
44+
+
45+
[IMPORTANT]
46+
====
47+
If you used the `--manifests-only` flag during the mirroring process and want to further trim the subset of packages to mirror, see the steps in the link:https://docs.openshift.com/container-platform/4.7/operators/admin/olm-managing-custom-catalogs.html#olm-mirroring-package-manifest-catalog_olm-managing-custom-catalogs[Mirroring a package manifest format catalog image] procedure of the {product-title} 4.7 documentation about modifying your `mapping.txt` file and using the file with the `oc image mirror` command.
48+
====
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * installing/installing-mirroring-installation-images.adoc
4+
5+
[id="olm-mirror-catalog-post_{context}"]
6+
= Post-installation requirements
7+
8+
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 populate and enable installation of Operators from OperatorHub.

0 commit comments

Comments
 (0)