|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * updating/updating-restricted-network-cluster.adoc |
| 4 | + |
| 5 | +[id="generating-icsp-object-scoped-to-a-registry_{context}"] |
| 6 | += Widening the scope of the mirror image catalog to reduce the frequency of cluster node reboots |
| 7 | + |
| 8 | +You can scope the mirrored image catalog at the repository level or the wider registry level. A widely scoped `ImageContentSourcePolicy` resource reduces the number of times the nodes need to reboot in response to changes to the resource. |
| 9 | + |
| 10 | +To widen the scope of the mirror image catalog in the `ImageContentSourcePolicy` resource, perform the following procedure. |
| 11 | + |
| 12 | +.Prerequisites |
| 13 | + |
| 14 | +* Install the {product-title} CLI `oc`. |
| 15 | +* Log in as a user with `cluster-admin` privileges. |
| 16 | +* Configure a mirrored image catalog for use in your disconnected cluster. |
| 17 | + |
| 18 | +.Procedure |
| 19 | + |
| 20 | +. Run the following command, specifying values for `<local_registry>`, `<pull_spec>`, and `<pull_secret_file>`: |
| 21 | ++ |
| 22 | +[source,terminal] |
| 23 | +---- |
| 24 | +$ oc adm catalog mirror <local_registry>/<pull_spec> <local_registry> -a <pull_secret_file> --icsp-scope=registry |
| 25 | +---- |
| 26 | ++ |
| 27 | +where: |
| 28 | ++ |
| 29 | +-- |
| 30 | +<local_registry>:: is the local registry you have configured for your disconnected cluster, for example, `local.registry:5000`. |
| 31 | +<pull_spec>:: is the pull specification as configured in your disconnected registry, for example, `redhat/redhat-operator-index:v{product-version}` |
| 32 | +<pull_secret_file>:: is the `registry.redhat.io` pull secret in `.json` file format downloaded from the link:https://cloud.redhat.com/openshift/install/pull-secret[Pull Secret] page on the {cloud-redhat-com} site. |
| 33 | +-- |
| 34 | ++ |
| 35 | +The `oc adm catalog mirror` command creates a `/redhat-operator-index-manifests` directory and generates `imageContentSourcePolicy.yaml`, `catalogSource.yaml`, and `mapping.txt` files. |
| 36 | + |
| 37 | +. Apply the new `ImageContentSourcePolicy` resource to the cluster: |
| 38 | ++ |
| 39 | +[source,terminal] |
| 40 | +---- |
| 41 | +$ oc apply -f imageContentSourcePolicy.yaml |
| 42 | +---- |
| 43 | + |
| 44 | +.Verification |
| 45 | + |
| 46 | +* Verify that `oc apply` successfully applied the change to `ImageContentSourcePolicy`: |
| 47 | ++ |
| 48 | +[source,terminal] |
| 49 | +---- |
| 50 | +$ oc get ImageContentSourcePolicy -o yaml |
| 51 | +---- |
| 52 | ++ |
| 53 | +.Example output |
| 54 | + |
| 55 | +[source,yaml] |
| 56 | +---- |
| 57 | +apiVersion: v1 |
| 58 | +items: |
| 59 | +- apiVersion: operator.openshift.io/v1alpha1 |
| 60 | + kind: ImageContentSourcePolicy |
| 61 | + metadata: |
| 62 | + annotations: |
| 63 | + kubectl.kubernetes.io/last-applied-configuration: | |
| 64 | + {"apiVersion":"operator.openshift.io/v1alpha1","kind":"ImageContentSourcePolicy","metadata":{"annotations":{},"name":"redhat-operator-index"},"spec":{"repositoryDigestMirrors":[{"mirrors":["local.registry:5000"],"source":"registry.redhat.io"}]}} |
| 65 | +... |
| 66 | +---- |
| 67 | + |
| 68 | +After you update the `ImageContentSourcePolicy` resource, {product-title} deploys the new settings to each node and the cluster starts using the mirrored repository for requests to the source repository. |
0 commit comments