How to customize the catalog name and tags of Operators mirrored to the mirror registry using the oc mirror plugin?
Environment
- Red Hat OpenShift Container Platform (RHOCP)
- 4.11 or later
- oc mirror plugin
Issue
- From OCP4.11 onwards, the catalog images of Operator indexes have become file-based, and the
opm index prunecommand is no longer usable. - The
opm index prunecommand allowed you to customize the catalog name and tag name with the-toption. - What should you set to customize the catalog name and tag name referred to by the oc mirror plugin and mirror it to the mirror registry?
Resolution
- Set the custom catalog name and tag name within the ImageSetConfiguration resource.
- You can define the catalog name with
mirror.operators.targetCatalog, and the tag name withmirror.operators.targetTag. Below is an example of the settings.
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
registry:
imageURL: example.com/mirror/oc-mirror-metadata
skipTLS: false
mirror:
operators:
- catalog: registry.redhat.io/redhat/redhat-operator-index:v4.13
targetCatalog: mirror/mirror-operator-index <----
targetTag: v1.0 <----
packages:
- name: elasticsearch-operator
channels:
- name: stable
- name: cluster-logging
channels:
- name: stable
Root Cause
- With the oc mirror plugin, almost all settings are written in the ImageSetConfiguration resource. Rather than command-line arguments like opm subcommands, it allows you to store setting values in a file, simplifying management.
Product(s)
Components
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.