How to customize the catalog name and tags of Operators mirrored to the mirror registry using the oc mirror plugin?

Solution Verified - Updated

Environment

Issue

  • From OCP4.11 onwards, the catalog images of Operator indexes have become file-based, and the opm index prune command is no longer usable.
  • The opm index prune command allowed you to customize the catalog name and tag name with the -t option.
  • 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 with mirror.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.
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.