When mirroring CP4I (and other IBM container images) to private registries such as GitLab, you may run into a scenario where your mirroring process fails because your private repository does not allow you to have more than a 2 path depth in your target repository. IBM container images are usually stored in sub repositories in IBM Entitled Registry, like so cp.icr.io/org/suborg/repo:tag
and will fail to mirror since the path depth for this image is 3.
The CP4I documentation for mirroring images in an airgapped environment leverage the ibm-pak plugin to mirror images. The process requires you to set some environment variables for operator package name, operator version, and your target registry.
export OPERATOR_PACKAGE_NAME=ibm-integration-platform-navigator
export OPERATOR_VERSION=7.3.3
export TARGET_REGISTRY=<target-registry>
Generally, your private registry administrator will provide an organization to mirror your images into, so TARGET_REGISTRY
becomes something similar to
export TARGET_REGISTRY=registry.example.com/myorganization
You are then asked to generate some mirror-manifests to assist the mirroring process
oc ibm-pak generate mirror-manifests $OPERATOR_PACKAGE_NAME --version $OPERATOR_VERSION $TARGET_REGISTRY
The ibm-pak plugin will generate the manifests, and will instruct later steps in the mirroring process to mirror cp.icr.io/org/suborg/repo:tag
into registry.example.com/myorganization/org/suborg/repo:tag
which will fail since the target repository has a path depth of 4. To work around this, you can append the --max-components 2
argument to the oc ibm-pak generate mirror-manifests
command, which will instruct the ibm-pak plugin to use registry path compression.
oc ibm-pak generate mirror-manifests $OPERATOR_PACKAGE_NAME --version $OPERATOR_VERSION $TARGET_REGISTRY --max-components 2
The resulting manifests files will now instruct later steps to mirror cp.icr.io/org/suborg/repo:tag
into registry.example.com/myorganization/org-suborg-repo:tag
which will comply with the maximum 2 path depth restrictions of your private image registry.
Subsequent mirroring steps can continue as documented.