Skip to content

Commit f682065

Browse files
Merge pull request #71943 from snarayan-redhat/OSDOCS-8312_contentimp_ocmirror
OSDOCS#8312: oc-mirror content improvement - Part 1
2 parents 2640590 + 94d2470 commit f682065

6 files changed

+184
-45
lines changed

installing/disconnected_install/installing-mirroring-disconnected.adoc

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,17 @@ Running your cluster in a restricted network without direct internet connectivit
1010

1111
You can use the oc-mirror OpenShift CLI (`oc`) plugin to mirror images to a mirror registry in your fully or partially disconnected environments. You must run oc-mirror from a system with internet connectivity in order to download the required images from the official Red Hat registries.
1212

13-
The following steps outline the high-level workflow on how to use the oc-mirror plugin to mirror images to a mirror registry:
14-
15-
. Create an image set configuration file.
16-
. Mirror the image set to the mirror registry by using one of the following methods:
17-
** Mirror an image set directly to the mirror registry.
18-
** Mirror an image set to disk, transfer the image set to the target environment, then upload the image set to the target mirror registry.
19-
. Configure your cluster to use the resources generated by the oc-mirror plugin.
20-
. Repeat these steps to update your mirror registry as necessary.
21-
2213
// About the oc-mirror plugin
2314
include::modules/oc-mirror-about.adoc[leveloffset=+1]
2415

2516
// oc-mirror compatibility and support
2617
include::modules/oc-mirror-support.adoc[leveloffset=+1]
2718

19+
[role="_additional-resources"]
20+
.Additional resources
21+
22+
* For information on updating oc-mirror, see xref:../../installing/validating-an-installation.adoc#viewing-the-image-pull-source_validating-an-installation[Viewing the image pull source].
23+
2824
// About the mirror registry
2925
include::modules/installation-about-mirror-registry.adoc[leveloffset=+1]
3026

@@ -100,18 +96,10 @@ include::modules/oc-mirror-disk-to-mirror.adoc[leveloffset=+3]
10096
// Configuring your cluster to use the resources generated by oc-mirror
10197
include::modules/oc-mirror-updating-cluster-manifests.adoc[leveloffset=+1]
10298

103-
[id="updating-mirror-registry-content"]
104-
== Keeping your mirror registry content updated
105-
106-
After your target mirror registry is populated with the initial image set, be sure to update it regularly so that it has the latest content. You can optionally set up a cron job, if possible, so that the mirror registry is updated on a regular basis.
107-
108-
Ensure that you update your image set configuration to add or remove {product-title} and Operator releases as necessary. Any images that are removed are pruned from the mirror registry.
109-
11099
// About updating your mirror registry content
111-
include::modules/oc-mirror-updating-registry-about.adoc[leveloffset=+2]
100+
include::modules/oc-mirror-updating-registry-about.adoc[leveloffset=+1]
112101

113-
// Updating your mirror registry content
114-
include::modules/oc-mirror-differential-updates.adoc[leveloffset=+2]
102+
include::modules/oc-mirror-updating-use-cases.adoc[leveloffset=+2]
115103

116104
[role="_additional-resources"]
117105
.Additional resources

modules/oc-mirror-about.adoc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,38 @@
1010
You can use the oc-mirror OpenShift CLI (`oc`) plugin to mirror all required {product-title} content and other images to your mirror registry by using a single tool. It provides the following features:
1111

1212
* Provides a centralized method to mirror {product-title} releases, Operators, helm charts, and other images.
13+
1314
* Maintains update paths for {product-title} and Operators.
15+
1416
* Uses a declarative image set configuration file to include only the {product-title} releases, Operators, and images that your cluster needs.
17+
1518
* Performs incremental mirroring, which reduces the size of future image sets.
19+
1620
* Prunes images from the target mirror registry that were excluded from the image set configuration since the previous execution.
21+
1722
* Optionally generates supporting artifacts for OpenShift Update Service (OSUS) usage.
1823
1924
When using the oc-mirror plugin, you specify which content to mirror in an image set configuration file. In this YAML file, you can fine-tune the configuration to only include the {product-title} releases and Operators that your cluster needs. This reduces the amount of data that you need to download and transfer. The oc-mirror plugin can also mirror arbitrary helm charts and additional container images to assist users in seamlessly synchronizing their workloads onto mirror registries.
2025

2126
The first time you run the oc-mirror plugin, it populates your mirror registry with the required content to perform your disconnected cluster installation or update. In order for your disconnected cluster to continue receiving updates, you must keep your mirror registry updated. To update your mirror registry, you run the oc-mirror plugin using the same configuration as the first time you ran it. The oc-mirror plugin references the metadata from the storage backend and only downloads what has been released since the last time you ran the tool. This provides update paths for {product-title} and Operators and performs dependency resolution as required.
2227

28+
[id="installation-oc-mirror-workflow_{context}"]
29+
== High level workflow
30+
The following steps outline the high-level workflow on how to use the oc-mirror plugin to mirror images to a mirror registry:
31+
32+
. Create an image set configuration file.
33+
34+
. Mirror the image set to the target mirror registry by using one of the following methods:
35+
36+
** Mirror an image set directly to the target mirror registry.
37+
38+
** Mirror an image set to disk, transfer the image set to the target environment, then upload the image set to the target mirror registry.
39+
40+
. Configure your cluster to use the resources generated by the oc-mirror plugin.
41+
42+
. Repeat these steps to update your target mirror registry as necessary.
43+
2344
[IMPORTANT]
2445
====
25-
When using the oc-mirror CLI plugin to populate a mirror registry, any further updates to the mirror registry must be made using the oc-mirror tool.
46+
When using the oc-mirror CLI plugin to populate a mirror registry, any further updates to the target mirror registry must be made by using the oc-mirror plugin.
2647
====

modules/oc-mirror-image-set-config-examples.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,4 +246,4 @@ mirror:
246246
version: 0.2.0
247247
additionalImages:
248248
- name: registry.redhat.io/ubi9/ubi:latest
249-
----
249+
----

modules/oc-mirror-installing-plugin.adoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77
[id="installation-oc-mirror-installing-plugin_{context}"]
88
= Installing the oc-mirror OpenShift CLI plugin
99

10-
To use the oc-mirror OpenShift CLI plugin to mirror registry images, you must install the plugin. If you are mirroring image sets in a fully disconnected environment, ensure that you install the oc-mirror plugin on the host with internet access and the host in the disconnected environment with access to the mirror registry.
11-
1210
.Prerequisites
1311

14-
* You have installed the OpenShift CLI (`oc`).
12+
* You have installed the OpenShift CLI (`oc`). If you are mirroring image sets in a fully disconnected environment, ensure the following:
13+
14+
** You have installed the oc-mirror plugin on the host that has internet access.
15+
16+
** The host in the disconnected environment has access to the target mirror registry.
17+
1518
* You have set the `umask` parameter to `0022` on the operating system that uses oc-mirror.
16-
* You have installed the correct binary for the {op-system-base} version that you are using.
19+
20+
* You have installed the correct binary for the {op-system-base} version that you are using.
21+
1722
1823
.Procedure
1924

modules/oc-mirror-updating-registry-about.adoc

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,26 @@
55

66
:_mod-docs-content-type: CONCEPT
77
[id="oc-mirror-updating-registry-about_{context}"]
8-
= About updating your mirror registry content
8+
= Updating your mirror registry content
99

10-
When you run the oc-mirror plugin again, it generates an image set that only contains new and updated images since the previous execution. Because it only pulls in the differences since the previous image set was created, the generated image set is often smaller and faster to process than the initial image set.
10+
You can update your mirror registry content by updating the image set configuration file and mirroring the image set to the mirror registry. The next time that you run the oc-mirror plugin, an image set is generated that only contains new and updated images since the previous execution.
1111

12-
[IMPORTANT]
13-
====
14-
Generated image sets are sequential and must be pushed to the target mirror registry in order. You can derive the sequence number from the file name of the generated image set archive file.
15-
====
12+
While updating the mirror registry, you must take into account the following considerations:
1613

17-
[discrete]
18-
== Adding new and updated images
14+
* Images are pruned from the target mirror registry if they are no longer included in the latest image set that was generated and mirrored. Therefore, ensure that you are updating images for the same combination of the following key components so that only a differential image set is created and mirrored:
1915
20-
Depending on the settings in your image set configuration, future executions of oc-mirror can mirror additional new and updated images. Review the settings in your image set configuration to ensure that you are retrieving new versions as necessary. For example, you can set the minimum and maximum versions of Operators to mirror if you want to restrict to specific versions. Alternatively, you can set the minimum version as a starting point to mirror, but keep the version range open so you keep receiving new Operator versions on future executions of oc-mirror. Omitting any minimum or maximum version gives you the full version history of an Operator in a channel. Omitting explicitly named channels gives you all releases in all channels of the specified Operator. Omitting any named Operator gives you the entire catalog of all Operators and all their versions ever released.
16+
** Image set configuration
2117

22-
All these constraints and conditions are evaluated against the publicly released content by Red Hat on every invocation of oc-mirror. This way, it automatically picks up new releases and entirely new Operators. Constraints can be specified by only listing a desired set of Operators, which will not automatically add other newly released Operators into the mirror set. You can also specify a particular release channel, which limits mirroring to just this channel and not any new channels that have been added. This is important for Operator products, such as Red Hat Quay, that use different release channels for their minor releases. Lastly, you can specify a maximum version of a particular Operator, which causes the tool to only mirror the specified version range so that you do not automatically get any newer releases past the maximum version mirrored. In all these cases, you must update the image set configuration file to broaden the scope of the mirroring of Operators to get other Operators, new channels, and newer versions of Operators to be available in your target registry.
18+
** Destination registry
2319

24-
It is recommended to align constraints like channel specification or version ranges with the release strategy that a particular Operator has chosen. For example, when the Operator uses a `stable` channel, you should restrict mirroring to that channel and potentially a minimum version to find the right balance between download volume and getting stable updates regularly. If the Operator chooses a release version channel scheme, for example `stable-3.7`, you should mirror all releases in that channel. This allows you to keep receiving patch versions of the Operator, for example `3.7.1`. You can also regularly adjust the image set configuration to add channels for new product releases, for example `stable-3.8`.
20+
** Storage configuration
2521

26-
[discrete]
27-
== Pruning images
22+
* The images can be pruned in case of disk to mirror or mirror to mirror workflow.
2823
29-
Images are pruned automatically from the target mirror registry if they are no longer included in the latest image set that was generated and mirrored. This allows you to easily manage and clean up unneeded content and reclaim storage resources.
24+
* The generated image sets must be pushed to the target mirror registry in sequence. You can derive the sequence number from the file name of the generated image set archive file.
3025
31-
If there are {product-title} releases or Operator versions that you no longer need, you can modify your image set configuration to exclude them, and they will be pruned from the mirror registry upon mirroring. This can be done by adjusting a minimum or maximum version range setting per Operator in the image set configuration file or by deleting the Operator from the list of Operators to mirror from the catalog. You can also remove entire Operator catalogs or entire {product-title} releases from the configuration file.
26+
* Do not delete or modify the metadata image that is generated by the oc-mirror plugin.
3227
33-
[IMPORTANT]
34-
====
35-
If there are no new or updated images to mirror, the excluded images are not pruned from the target mirror registry. Additionally, if an Operator publisher removes an Operator version from a channel, the removed versions are pruned from the target mirror registry.
36-
====
28+
* If you specified a top-level namespace for the mirror registry during the initial image set creation, then you must use this same namespace every time you run the oc-mirror plugin for the same mirror registry.
3729
38-
To disable automatic pruning of images from the target mirror registry, pass the `--skip-pruning` flag to the `oc mirror` command.
30+
For more information about the workflow to update the mirror registry content, see the "High level workflow" section.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * updating/updating_a_cluster/updating_disconnected_cluster/mirroring-image-repository.adoc
4+
5+
:_mod-docs-content-type: REFERENCE
6+
[id="oc-mirror-image-set-examples-add-images_{context}"]
7+
= Mirror registry update examples
8+
9+
This section covers the use cases for updating the mirror registry from disk to mirror.
10+
11+
.Example `ImageSetConfiguration` file that was previously used for mirroring:
12+
13+
[source, yaml]
14+
----
15+
apiVersion: mirror.openshift.io/v1alpha2
16+
kind: ImageSetConfiguration
17+
storageConfig:
18+
local:
19+
path: /home/user/metadata
20+
mirror:
21+
platform:
22+
channels:
23+
- name: stable-4.12
24+
minVersion: 4.12.1
25+
maxVersion: 4.12.1
26+
operators:
27+
- catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
28+
packages:
29+
- name: rhacs-operator
30+
channels:
31+
- name: stable
32+
----
33+
34+
[discrete]
35+
== Mirroring a specific {product-title} version by pruning the existing images
36+
37+
.Updated `ImageSetConfiguration` file:
38+
39+
[source,yaml]
40+
----
41+
apiVersion: mirror.openshift.io/v1alpha2
42+
kind: ImageSetConfiguration
43+
storageConfig:
44+
local:
45+
path: /home/user/metadata
46+
mirror:
47+
platform:
48+
channels:
49+
- name: stable-4.13 #<1>
50+
operators:
51+
- catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
52+
packages:
53+
- name: rhacs-operator
54+
channels:
55+
- name: stable
56+
----
57+
<1> Replacing by `stable-4.13` prunes all the images of `stable-4.12`.
58+
59+
[discrete]
60+
== Updating to the latest version of an Operator by pruning the existing images
61+
62+
.Updated `ImageSetConfiguration` file:
63+
64+
[source,yaml,subs=attributes+]
65+
----
66+
apiVersion: mirror.openshift.io/v1alpha2
67+
kind: ImageSetConfiguration
68+
storageConfig:
69+
local:
70+
path: /home/user/metadata
71+
mirror:
72+
platform:
73+
channels:
74+
- name: stable-4.12
75+
minVersion: 4.12.1
76+
maxVersion: 4.12.1
77+
operators:
78+
- catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
79+
packages:
80+
- name: rhacs-operator
81+
channels:
82+
- name: stable #<1>
83+
----
84+
<1> Using the same channel without specifying a version prunes the existing images and updates with the latest version of images.
85+
86+
87+
[discrete]
88+
[id="oc-mirror-image-set-examples-operator-pruning-versions_{context}"]
89+
== Mirroring a new Operator by pruning the existing Operator
90+
91+
.Updated `ImageSetConfiguration` file:
92+
93+
[source,yaml,subs=attributes+]
94+
----
95+
apiVersion: mirror.openshift.io/v1alpha2
96+
kind: ImageSetConfiguration
97+
storageConfig:
98+
local:
99+
path: /home/user/metadata
100+
mirror:
101+
platform:
102+
channels:
103+
- name: stable-4.12
104+
minVersion: 4.12.1
105+
maxVersion: 4.12.1
106+
operators:
107+
- catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
108+
packages:
109+
- name: <new_operator_name> #<1>
110+
channels:
111+
- name: stable
112+
----
113+
<1> Replacing `rhacs-operator` with `new_operator_name` prunes the Red Hat Advanced Cluster Security for Kubernetes Operator.
114+
115+
[discrete]
116+
== Pruning all the {product-title} images
117+
118+
.Updated `ImageSetConfiguration` file:
119+
120+
[source,yaml,subs=attributes+]
121+
----
122+
apiVersion: mirror.openshift.io/v1alpha2
123+
kind: ImageSetConfiguration
124+
storageConfig:
125+
local:
126+
path: /home/user/metadata
127+
mirror:
128+
platform:
129+
channels:
130+
operators:
131+
- catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
132+
packages:
133+
----

0 commit comments

Comments
 (0)