These scripts simplify the process of OperatorHub Image mirroring for OpenShif 4.X environment.
For OpenShift 4.X, If you want to use OperatorHub in the restricted network environment. You must download the Operator images and bring them to your OpenShift environment, then push them to your private registry. These scripts will simplify the steps of this mirroring process.
- Make sure you already dump the OperatorHub catalog manifest (called
mapping.txt
). Filter the list to remain the Images you want to mirror.
$ cat mapping.txt | egrep '(logging|elastic|proxy|...)' >> origin.txt
- Edit the
convert.sh
script. Modify the Private Registry URL.
$ vim convert.sh
#!/bin/bash
PRIVATE_REGISTRY="private-registry.example.com"
#------------------------
...
- Execute
convert.sh
. It will create two files:
auto_redhat_to_file.txt
: The mapping file for mirror image from external registry to local.auto_file_to_private.txt
: The mapping for mirror image from local to private registry.
$ bash convert.sh
- Optional: If your private registry will not create the project automatically. You need to create them before mirroring them.
Modify get-project-name.sh
.
$ vim get-project-name.sh
PRIVATE_REGISTRY="private-registry.example.com"
Get the project list of Image.
$ bash get-project-name.sh
- Mirror the Image.
From external registry to local:
$ oc image mirror -a ${REG_CREDS} -f auto_redhat_to_file.txt --filter-by-os=".*"
From local to private registry:
$ oc image mirror -a ${REG_CREDS} -f auto_file_to_private.txt --filter-by-os=".*"