// Module included in the following assemblies:
//
// * installing/disconnected_install/installing-mirroring-disconnected-v2.adoc

:_mod-docs-content-type: REFERENCE
[id="oc-mirror-operator-catalog-filtering_{context}"]
= How filtering works in the operator catalog

oc-mirror plugin v2 selects the list of bundles for mirroring by processing the information in `imageSetConfig`.

When oc-mirror plugin v2 selects bundles for mirroring, it does not infer Group Version Kind (GVK) or bundle dependencies, omitting them from the mirroring set. Instead, it strictly adheres to the user instructions. You must explicitly specify any required dependent packages and their versions.

.Use the following table to see what bundle versions are included in different scenarios
[cols="1,2",options="header"]

|===

|ImageSetConfig operator filtering
|Expected bundle versions


a|Scenario 1

[source,yaml]
----
mirror:
 operators:
   - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
----
|For each package in the catalog, one bundle, corresponding to the head version for each channel of that package.

a|Scenario 2

[source,yaml]
----
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
      full: true
----
|All bundles of all channels of the specified catalog.

a|Scenario 3

[source,yaml]
----
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
     packages:
    - name: compliance-operator
----
|One bundle, corresponding to the head version for each channel of that package.

a|Scenario 4

[source,yaml]
----
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
      full: true
      - packages:
          - name: elasticsearch-operator
----
|All bundles of all channels for the packages specified.

a|Scenario 5

[source,yaml]
----
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
    packages:
    - name: compliance-operator
       minVersion: 5.6.0
----
|All bundles in all channels, from the `minVersion`, up to the channel head for that package.

a|Scenario 6

[source,yaml]
----
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
    packages:
    - name: compliance-operator
        maxVersion: 6.0.0
----
|All bundles in all channels that are lower than the `maxVersion` for that package.

a|Scenario 7

[source,yaml]
----
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
    packages:
    - name: compliance-operator
        minVersion: 5.6.0
        maxVersion: 6.0.0
----
|All bundles in all channels, between the `minVersion` and `maxVersion` for that package. The head of the channel is not included, even if multiple channels are included in the filtering.

a|Scenario 8

[source,yaml]
----
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
    packages:
    - name: compliance-operator
        channels
          - name: stable
----
|The head bundle for the selected channel of that package. You must use the `defaultChannel` field in case the filtered channels are not the default.

a|Scenario 9

[source,yaml]
----
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
      full: true
      - packages:
          - name: elasticsearch-operator
            channels:
               - name: 'stable-v0'
----
|All bundles for the packages and channels specified.
The `defaultChannel` should be used in case the filtered channels are not the default.

a|Scenario 10

[source,yaml]
----
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
    packages:
    - name: compliance-operator
        channels
          - name: stable
          - name: stable-5.5
----
|The head bundle for each selected channel of that package.

a|Scenario 11

[source,yaml]
----
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
    packages:
    - name: compliance-operator
        channels
          - name: stable
            minVersion: 5.6.0
----
|Within the selected channel of that package, all versions starting with the `minVersion` up to the channel head. You must use the `defaultChannel` field in case the filtered channels are not the default.

a|Scenario 12

[source,yaml]
----
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
    packages:
    - name: compliance-operator
        channels
          - name: stable
            maxVersion: 6.0.0
----
|Within the selected channel of that package, all versions up to `maxVersion`.
Head of channel is not included, even if multiple channels are included in the filtering.
You might see errors if this filtering leads to a channel with multiple heads. You must use the `defaultChannel` field in case the filtered channels are not the default.

a|Scenario 13

[source,yaml]
----
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
    packages:
    - name: compliance-operator
       channels
          - name: stable
            minVersion: 5.6.0
            maxVersion: 6.0.0
----
|Within the selected channel of that package, all versions between the `minVersion` and `maxVersion`. The head of channel is not included, even if multiple channels are included in the filtering.
You might see errors if this filtering leads to a channel with multiple heads. You must use the `defaultChannel` field in case the filtered channels are not the default.

a|Scenario 14

[source,yaml]
----
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
    packages:
    - name: compliance-operator
        channels
          - name: stable
        minVersion: 5.6.0
        maxVersion: 6.0.0
----
|Do not use this scenario. filtering by channel and by package with a `minVersion` or `maxVersion` is not allowed.

a|Scenario 15

[source,yaml]
----
mirror:
  operators:
   - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
    packages:
    - name: compliance-operator
        channels
          - name: stable
        minVersion: 5.6.0
        maxVersion: 6.0.0
----
|Do not use this scenario. You cannot filter using `full:true` and the `minVersion` or `maxVersion`.

a|Scenario 16

[source,yaml]
----
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.15
      full: true
    packages:
    - name: compliance-operator
        channels
          - name: stable
            minVersion: 5.6.0
            maxVersion: 6.0.0
----
|Do not use this scenario. You cannot filter using `full:true` and the `minVersion` or `maxVersion`.

|===

