This repository provides playbooks that will mirror OpenShift operator images for a disconnected OpenShift installation. The first playbook will mirror the operators to local disk and create a bundle file to transfer to the disconnected network. On the disconnected network, a second playbook will be run to mirror the operators to the disconnected registry.
NOTE: This process requires an accessible container registry when performing operator downloads on the
connected
host. In a true disconnected environment, this requires two container registries, one accessible fromconnected
and the actual disconnected hostregistry
.
This playbook was written specifically to work with Quay as the disconnected registry. It may or may not work if the disconnected registry is something else.
- Internet-connected host with podman installed
Tested with:
- podman 2.2.1
- RHEL 8.3
- Appropriate disk space for the operator images. Depending on which and how many operators are mirrored, the disk space requirements can vary greatly. You may need as little as 5G for one operator and upto 300G for multiple operators.
- Mechanism to transfer bundle to disconnected network
- Host on disconnected network running Quay
Tested with:
- Quay 3.4.3
- RHEL 8 host
- openshift-client binary matching x.y
ocp_release
- opm binary matching x.y of
ocp_release
- Quay credentials
- Quay organization is already created
- Quay credentials have write access to organization
- Ensure certificate used by registry is trusted
In either /etc/ansible/hosts
or a local inventory.yml
, configure your inventory for your container host using a local connection. Substitute for localhost
as appropriate for the environment. connected
should have internet connectivity.
registry:
hosts:
localhost:
vars:
ansible_connection: local
connected:
hosts:
localhost:
vars:
ansible_connection: local
Pre-populated entries are set in
roles/olm-mirror/defaults/main.yml
and are ready to be used. However, the values should be customized to your particular environment. These variables are used for downloading and building the disconnected registsry tar file and for populating the disconnected registry itself. The default values may be overridden any place that takes higher precedence.
operator_list
: A list of dictionary values withname
andmirror
for each operator
The intention was to allow the use of
mirror
to control whether a particular operator was acutally downlaoded for mirroring. This may not be a viable solution, and you should set all operators tomirror: yes
for the time-being.
cleanup
: yes|no
Using
cleanup: no
will preserve downloaded files so you can avoid having to wait for operators to downloaded when running this multiple times
mirror_dir
: where operators will be downloaded to bundle for transferbundle_dir
: where the bundled operator files are stored
the filesystem for 3 and 4 should in total equal 2x the size of the operators being download (or equal size if different filesystems)
operator_bundle
: full path of bundle file with all operatorslocal_registry
: url (with port if necessary) of disconnected registrylocal_namespace
: must exist in registrypullsecret
: full path to pull-secret from https://cloud.redhat.comregistry_secret
: full path to disconnected registry pull secretkubeconfig
: full path to kubeconfig file for disconnected cluster (needed to udpateImageContentSourcePolicy
)validate_cluster_cert
: set tono
if the cluster cert is not trusted already
NOTE: there are other options for handling authentication to the cluster if desired
Run the download-operators.yml
playbook on the connected
host. This will create a tar file at {{ bundle_file }}
. Next, the tar.gz file should be transferred to {{ bundle_file }}
on the registry
host.
Ensure the approriate information is configured as defined in
roles/olm-mirror/defaults/main.yml
or the appropriate alternate location as required.
disconnected_registry_user
has already been created withdisconnected_registry_pass
in the registry onregistry
(for Quay this should be a super-user)- The username/password has been appropriately configured as a valid pull-secret and stored at
registry_secret
. local_namespace
has been created onregistry
when using Quay. This should be anorganization
. Ensure this is created with the same user asdisconnected_registry_user
or thatdisconnected_registry_user
has the appropriate write permissions to theorganization
.
NOTE: For test environments, the
registry
host does not have to actually be disconnected and may actually be the same host used to do the initial mirror to disk.
# if using /etc/ansible/hosts
ansible-playbook download-operators.yml
# if using inventory.yml
ansible-playbook -i inventory.yml download-release.yml
# if using custom variable file
ansible-playbook download-operators.yml -e@myvars.yml
NOTE: This must run on an internet connected host.
This playbook will:
- TBD
Upload by using mapping.txt directly, and to work around a bug in Quay, the mapping.txt is split into chunks of 10 lines to limit the rate data is uploaded.
# if using /etc/ansible/hosts or inventory configure in ansible.cfg
ansible-playbook upload-release.yml
# if using inventory.yml
ansible-playbook -i inventory.yml upload-release.yml
# if using custom variable file
ansible-playbook upload-release.yml -e@myvars.yml
This playbook will:
- TBD