Skip to content

4.1 Apply Cluster Resources

Patch the OperatorHub

Before importing these cluster sources, it's best to disable all default catalog sources with this command (as OperatorHub will be actively trying to connect to the Internet to fetch them)

oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'

Cluster Resources

Red Hat Docs

From your oc mirror command, you could have the following files in your working-dir i.e. /opt/4.17-mirrordata/working-dir/cluster-resources/. It all depends on what you mirrored.

  • idms-oc-mirror.yaml: This is a list of mappings between the original public registry and your local registry for all images that are identified by their digest (ImageDigestMirrorSet).
  • itms-oc-mirror.yaml: This is a list of mappings between the original public registry and your local registry for all images that are identified by their tag (ImageTagMirrorSet).
  • cs-redhat-operator-index-v4-17.yaml/cc-redhat-operator-index-v4-17.yaml: This is the CatalogSource/ClusterCatalog for RedHat Operators.

    Important!

    Change the name the cs-redhat-operator-index-v4-17.yaml/cc-redhat-operator-index-v4-17.yaml catalog source in the YAML file to redhat-operators as some operators are hardcoded reference this exact catalog source name. Examples below with the highlighted value:

    Tip

    Use a quick sed command to set the name in both files

    sed -i 's/name: cs-redhat-operator-index-v4-17/name: redhat-operators/' /opt/4.17-mirrordata/working-dir/cluster-resources/cs-redhat-operator-index-v4-17.yaml
    sed -i 's/name: cc-redhat-operator-index-v4-17/name: redhat-operators/' /opt/4.17-mirrordata/working-dir/cluster-resources/cc-redhat-operator-index-v4-17.yaml
    

    Example: cs-redhat-operator-index-v4-17.yaml
    apiVersion: operators.coreos.com/v1alpha1
    kind: CatalogSource
    metadata:
      name: redhat-operators
      namespace: openshift-marketplace
    spec:
      image: registry.example.com:8443/ocp/redhat/redhat-operator-index:v4.17
      sourceType: grpc
    status: {}
    
    Example: cc-redhat-operator-index-v4-19.yaml
    apiVersion: olm.operatorframework.io/v1
    kind: ClusterCatalog
    metadata:
      annotations:
        createdAt: Monday, 21-Jul-25 21:13:27 UTC
        createdBy: oc-mirror v2
        oc-mirror_version: 4.19.0-202507081507.p0.gf364aec.assembly.stream.el9-f364aec
      name: redhat-operators
    spec:
      priority: 0
      source:
        image:
          ref: registry.example.com:8443/ocp/redhat/redhat-operator-index:v4.19
        type: Image
    status: {}
    
  • cs-certified-operator-index-v4-17.yaml: This is the catalog for operators certified by Red Hat but not necessarily developed by Red Hat.

  • cs-community-operator-index-v4-17.yaml: This is the catalog source for all community based operators.

    Info

    If you have any ClusterCatalogs i.e cc-redhat-operator-index-v4-17.yaml, they will only work on OpenShift 4.18 or newer. Ignore errors from ClusterCatalogs when applying resources if you are on an older version of OpenShift

    This is due to changes in the Operator Lifecycle Manager (OLM) architecture moving from OLM classic to OLMv1: Red Hat Docs

Configure the cluster to use the resources you mirrored

Red Hat Docs

  1. Apply the cluster recources generated by the oc-mirror plugin. This will make your cluster aware of the catalog resources we mirrored earlier so you can utilze OperatorHub to install operators.

    oc apply -f /opt/4.17-mirrordata/working-dir/cluster-resources/
    
    Example Output
    catalogsource.operators.coreos.com/cs-certified-operator-index-v4-17 created
    catalogsource.operators.coreos.com/cs-community-operator-index-v4-17 created
    catalogsource.operators.coreos.com/redhat-operators created
    imagedigestmirrorset.config.openshift.io/idms-release-0 created
    imagedigestmirrorset.config.openshift.io/idms-operator-0 created
    imagetagmirrorset.config.openshift.io/itms-release-0 created
    imagetagmirrorset.config.openshift.io/itms-generic-0 created
    configmap/mirrored-release-signatures created
    

  2. If you mirrored release images, apply the release image signatures

    oc apply -f /opt/4.17-mirrordata/cluster-resources/signature-configmap.json
    

Important

If you are mirroring Operators instead of clusters, do not run the preceding command. Running the command results in an error because there are no release image signatures to apply.

Additionally, a YAML file is available in the same directory working-dir/cluster-resources/. You can use either the JSON or YAML format.

Verify resources have been applied

  1. Verify the CatalogSource has been installed. You may have some, all, or none of these depending on what Operators you mirrored.

    oc get catalogsource -A
    
    Example Output
    NAMESPACE               NAME                                DISPLAY   TYPE   PUBLISHER   AGE
    openshift-marketplace   cs-certified-operator-index-v4-17             grpc               2d
    openshift-marketplace   cs-community-operator-index-v4-17             grpc               2d
    openshift-marketplace   redhat-operators                              grpc               2d
    

  2. Verify that the ImageDigestMirrorSet resources are successfully installed

    oc get imagedigestmirrorset
    
    Example Output
    NAME                  AGE
    idms-operator-0       2d
    idms-release-0        2d
    image-digest-mirror   2d
    

  3. Verify that the ImageTagMirrorSet resources are successfully installed

    oc get imagetagmirrorset
    
    Example Output
    NAME             AGE
    itms-generic-0   2d
    itms-release-0   2d