Reduce overall storage required for Upgrades using oc-mirror!
Having a better control of the ammount of images that the administrator of OCP is downloading in the mirroring process to the offline registry it becomes to be one of a key requirement. This control implies a better storage usage management of the offline registry. How to achieve this management we are going to discuss further.
The following list represents the prerequisites that needs to be fullfilled before proceeding with the first step:
OCPv4.10.X
Redhat Enterprise Linux/Rocky Linux/Fedora
Downloaded pull-secret.txt file
podman package available to the OS
Step 1. How to reduce the overall storage for upgrading a operator using oc-mirror cli:
If you dont mention the parameter full or full:true (default value) this will overwite the minVersion and maxVersion values, therefore you will download all the odf-operator images available in the stable-4.10 channel:
a example of how to perform a mirror config for the imageset-config.yaml:
a example of the channel content for the registry.redhat.io/redhat/redhat-operator-index:v4.10:
odf-operator:
As you an see, the above imageset-config.yaml file will download all the container base images in the stable-4.10 channel of odf-operator, and this versions are the following: 4.10.0, 4.10.1, 4.10.2, 4.10.3, 4.10.4, 4.10.5. And in this way, you will required a additional disk space to host all the images.
In order to download only a specific odf-operator container base image you will need to use the following imageset-config.yaml configuration:
As you an see, the above imageset-config.yaml file will download only the version 4.10.4 the container base images in the stable-4.10 channel of odf-operator. And in this way, you will optimise the disk space to host all the images.
Operator Name
Channel Name
Size
Container base image versions downloaded
Size compaction
odf-operator
stable-4.10
25G
4.10.0, 4.10.1, 4.10.2, 4.10.3, 4.10.4, 4.10.5
-
odf-operator
stable-4.10
6.3G
4.10.4
75%
In order to mirror from different channel versions, you will need to use the oc-mirror cli and define the imageset-config.yaml file as below:
In order to mirror specific versions, you will need to use the oc-mirror cli and define the imageset-config.yaml file as below:
In order to proceed with the mirroring process we splitted the process in two stages:
Stage number 1. Where we are downloading the specific packages locally to a tar file:
Stage number 2. Where we are uploading the content of the local tar file to local offline registry:
Exporting the global variables:
Upload the container base images to the Offline Host registry:
Once those two stages are completed without errors, we will obtain the ICSP yaml file and we are able to verify the content of the local offline registry, to do so, use the following command:
For the first imageset-config.yaml the Offline Registry content its the following:
For the second imageset-config.yaml the Offline Registry content its the following:
Below we will compare the size of the bundle of odf-operator
Operator Name
Channel Name
Size
Container base image versions downloaded
Size compaction
odf-operator
stable-4.9 & stable-4.10
68G
4.10.0, 4.10.1, 4.10.2, 4.10.3, 4.10.4,
-
4.10.5
-
4.9.0, 4.9.1, 4.9.2, 4.9.3, 4.9.4, 4.9.5,
4.9.6, 4.9.7, 4.9.8, 4.9.9, 4.9.10
odf-operator
stable-4.9 & stable-4.10
12G
4.9.0 & 4.10.4
82%
The content of the imageContentSourcePolicy.yaml :
and the content of the catalogSource-rh-index.yaml:
As a conclusion, we can observe that using the full: false parameter, the mirroring process its taking in consideration the minVersion and maxVersion parameter values and its considering only the mention container image versions. Proceeding in this way, the used storage for the mirroring its reduced considerable.