OpenShift - oc-mirror - list operators

#### oc-mirror

OpenShift をインターネット非接続環境に導入 (disconnected installation) する際に、oc-mirror plugin が利用できます。

https://docs.redhat.com/ja/documentation/openshift_container_platform/4.16/html/installing/installing-mirroring-disconnected#installation-oc-mirror-about_installing-mirroring-disconnected

> oc-mirror OpenShift CLI(oc) プラグインを使用すると、単一のツールを使用して、必要なすべての OpenShift Container Platform コンテンツおよびその他のイメージをミラーレジストリーにミラーリングできます。次の機能を提供します。
> - OpenShift Container Platform のリリース、Operator、ヘルムチャート、およびその他のイメージをミラーリングするための一元化された方法を提供します。
> - OpenShift Container Platform および Operator の更新パスを維持します。
> - 宣言型イメージセット設定ファイルを使用して、クラスターに必要な OpenShift Container Platform リリース、Operator、およびイメージのみを含めます。
> - 将来のイメージセットのサイズを縮小するインクリメンタルミラーリングを実行します。
> - 前回の実行以降にイメージセット設定から除外されたターゲットミラーレジストリーからのイメージをプルーニングします。
> - オプションで、OpenShift Update Service (OSUS) を使用する際のサポートアーティファクトを生成します。 

ここでは、oc-mirror の機能の1つである、list operators（OperatorHub / Operator 情報の取得）をご紹介します。


#### list operators
`list operators` を使用してみます。
```shell
$ oc mirror list operators --help
List available operator catalog content and versions

Usage:
  oc-mirror list operators [flags]

Examples:
  # List available operator catalog release versions
  oc-mirror list operators

  # Output default operator catalogs for OpenShift release 4.8
  oc-mirror list operators --catalogs --version=4.8

  # List all operator packages in a catalog
  oc-mirror list operators --catalog=catalog-name

  # List all channels in an operator package
  oc-mirror list operators --catalog=catalog-name --package=package-name

  # List all available versions for a specified operator in a channel
  oc-mirror list operators --catalog=catalog-name --package=operator-name --channel=channel-name

Flags:
      --catalog string   List information for a specified catalog
      --catalogs         List available catalogs for an OpenShift release version, requires --version
      --channel string   List information for a specified channel
  -h, --help             help for operators
      --package string   List information for a specified package
  -v, --verbose int      Number for the log level verbosity (valid 1-9, default is 0)
      --version string   Specify an OpenShift release version
```

OperatorHub の catalog version 一覧を取得します。
```shell
$ oc mirror list operators
Available OpenShift OperatorHub catalog versions:
  v4.11
  v4.15
  v4.12
  v4.6
  v4.7
  v4.10
  v4.13
  v4.14
  v4.16
  v4.17
  v4.8
  sha256
  v4.5
  v4.9
```
`--version` に `4.16` を指定して、OperatorHub の catalog 一覧を取得してみます。
```shell
$ oc mirror list operators --catalogs --version 4.16
Available OpenShift OperatorHub catalogs:
OpenShift 4.16:
registry.redhat.io/redhat/redhat-operator-index:v4.16
registry.redhat.io/redhat/certified-operator-index:v4.16
registry.redhat.io/redhat/community-operator-index:v4.16
registry.redhat.io/redhat/redhat-marketplace-index:v4.16
```

`registry.redhat.io/redhat/redhat-operator-index:v4.16` の Operator 情報を取得してみます。
```shell
$ oc mirror list operators --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.16
NAME                                          DISPLAY NAME                                             DEFAULT CHANNEL
3scale-operator                               Red Hat Integration - 3scale                             threescale-2.14
advanced-cluster-management                   Advanced Cluster Management for Kubernetes               release-2.11
amq-broker-rhel8                              Red Hat Integration - AMQ Broker for RHEL 8 (Multiarch)  7.12.x
amq-online                                    Red Hat Integration - AMQ Online                         stable
amq-streams                                   Red Hat Streams for Apache Kafka                         stable
amq7-interconnect-operator                    Red Hat Integration - AMQ Interconnect                   1.10.x
ansible-automation-platform-operator          Ansible Automation Platform                              stable-2.4-cluster-scoped
ansible-cloud-addons-operator                 Ansible Cloud Addons                                     stable-2.4-cluster-scoped
apicast-operator                              Red Hat Integration - 3scale APIcast gateway             threescale-2.14
authorino-operator                            Red Hat - Authorino (Technical Preview)                  tech-preview-v1
aws-efs-csi-driver-operator                   AWS EFS CSI Driver Operator                              stable
aws-load-balancer-operator                    AWS Load Balancer Operator                               stable-v1
bamoe-businessautomation-operator             IBM Business Automation                                  8.x-stable
bamoe-kogito-operator                         IBM BAMOE Kogito Operator                                8.x
bare-metal-event-relay                        Bare Metal Event Relay                                   stable
businessautomation-operator                   Business Automation                                      stable
cincinnati-operator                           OpenShift Update Service                                 v1
cluster-kube-descheduler-operator             Kube Descheduler Operator                                stable
cluster-logging                               Red Hat OpenShift Logging                                stable-5.9
cluster-observability-operator                Cluster Observability Operator                           development
clusterresourceoverride                       ClusterResourceOverride Operator                         stable
compliance-operator                           Compliance Operator                                      stable
container-security-operator                   Red Hat Quay Container Security Operator                 stable-3.12
costmanagement-metrics-operator               Cost Management Metrics Operator                         stable
cryostat-operator                             Red Hat build of Cryostat                                stable
datagrid                                      Data Grid                                                stable
devspaces                                     Red Hat OpenShift Dev Spaces                             stable
devworkspace-operator                         DevWorkspace Operator                                    fast
dpu-network-operator                          DPU Network Operator                                     stable
dpu-operator                                  DPU Operator                                             stable
eap                                           JBoss EAP                                                stable
external-dns-operator                         ExternalDNS Operator                                     stable-v1
fence-agents-remediation                      Fence Agents Remediation Operator                        stable
file-integrity-operator                       File Integrity Operator                                  stable
fuse-apicurito                                Red Hat Integration - API Designer                       fuse-apicurito-7.13.x
fuse-console                                  Red Hat Integration - Fuse Console                       7.13.x
fuse-online                                   Red Hat Integration - Fuse Online                        latest
gatekeeper-operator-product                   Gatekeeper Operator                                      stable
gcp-filestore-csi-driver-operator             GCP Filestore CSI Driver Operator                        stable
ingress-node-firewall                         Ingress Node Firewall Operator                           stable
jaeger-product                                Red Hat OpenShift distributed tracing platform           stable
jws-operator                                  JWS Operator                                             alpha
kernel-module-management                      Kernel Module Management                                 stable
kernel-module-management-hub                  Kernel Module Management (Hub)                           stable
kiali-ossm                                    Kiali Operator                                           stable
kubernetes-nmstate-operator                   Kubernetes NMState Operator                              stable
kubevirt-hyperconverged                       OpenShift Virtualization                                 stable
lifecycle-agent                               Lifecycle Agent                                          stable
lightspeed-operator                           OpenShift Lightspeed Operator                            preview
local-storage-operator                        Local Storage                                            stable
logic-operator-rhel8                          OpenShift Serverless Logic Operator                      alpha
loki-operator                                 Loki Operator                                            stable-5.9
lvms-operator                                 LVM Storage                                              stable-4.16
machine-deletion-remediation                  Machine Deletion Remediation operator                    stable
mcg-operator                                  NooBaa Operator                                          stable-4.16
metallb-operator                              MetalLB Operator                                         stable
mta-operator                                  Migration Toolkit for Applications Operator              stable-v7.0
mtc-operator                                  Migration Toolkit for Containers Operator                release-v1.8
mtr-operator                                  Migration Toolkit for Runtimes Operator                  alpha
mtv-operator                                  Migration Toolkit for Virtualization Operator            release-v2.6
multiarch-tuning-operator                     Multiarch Tuning Operator                                tech-preview
multicluster-engine                           multicluster engine for Kubernetes                       stable-2.6
multicluster-global-hub-operator-rh           Multicluster Global Hub Operator                         release-1.2
netobserv-operator                            Network Observability                                    stable
nfd                                           Node Feature Discovery Operator                          stable
node-healthcheck-operator                     Node Health Check Operator                               stable
node-maintenance-operator                     Node Maintenance Operator                                stable
node-observability-operator                   Node Observability Operator                              alpha
numaresources-operator                        numaresources-operator                                   4.16
ocs-client-operator                           OpenShift Data Foundation Client                         stable-4.16
ocs-operator                                  OpenShift Container Storage                              stable-4.16
odf-compose-operator                          ODF Compose (DO NOT INSTALL)                             stable-4.15
odf-csi-addons-operator                       CSI Addons                                               stable-4.16
odf-multicluster-orchestrator                 ODF Multicluster Orchestrator                            stable-4.16
odf-operator                                  OpenShift Data Foundation                                stable-4.16
odf-prometheus-operator                       Prometheus Operator                                      stable-4.16
odr-cluster-operator                          Openshift DR Cluster Operator                            stable-4.16
odr-hub-operator                              Openshift DR Hub Operator                                stable-4.16
openshift-builds-operator                     builds for Red Hat OpenShift Operator                    latest
openshift-cert-manager-operator               cert-manager Operator for Red Hat OpenShift              stable-v1
openshift-custom-metrics-autoscaler-operator  Custom Metrics Autoscaler                                stable
openshift-gitops-operator                     Red Hat OpenShift GitOps                                 latest
openshift-pipelines-operator-rh               Red Hat OpenShift Pipelines                              latest
openshift-secondary-scheduler-operator        Secondary Scheduler Operator for Red Hat OpenShift       stable
opentelemetry-product                         Red Hat build of OpenTelemetry                           stable
power-monitoring-operator                     Power monitoring for Red Hat OpenShift                   tech-preview
ptp-operator                                  PTP Operator                                             stable
quay-bridge-operator                          Red Hat Quay Bridge Operator                             stable-3.12
quay-operator                                 Red Hat Quay                                             stable-3.12
recipe                                        Recipe                                                   stable-4.16
red-hat-camel-k                               Red Hat Integration - Camel K                            1.10.x
red-hat-hawtio-operator                       HawtIO Operator                                          stable-v1
redhat-oadp-operator                          OADP Operator                                            stable-1.4
rh-service-binding-operator                   Service Binding Operator                                 stable
rhacs-operator                                Advanced Cluster Security for Kubernetes                 stable
rhbk-operator                                 Keycloak Operator                                        stable-v24
rhdh                                          Red Hat Developer Hub Operator                           fast
rhods-operator                                Red Hat OpenShift AI                                     fast
rhods-prometheus-operator                     Prometheus Operator                                      beta
rhpam-kogito-operator                         RHPAM Kogito Operator                                    7.x
rhsso-operator                                Red Hat Single Sign-On Operator                          stable
rhtas-operator                                Red Hat Trusted Artifact Signer                          stable
rook-ceph-operator                            Rook-Ceph                                                stable-4.16
run-once-duration-override-operator           Run Once Duration Override Operator                      stable
sandboxed-containers-operator                 OpenShift sandboxed containers Operator                  stable
secrets-store-csi-driver-operator             Secrets Store CSI Driver Operator                        preview
security-profiles-operator                    Security Profiles Operator                               release-alpha-rhel-8
self-node-remediation                         Self Node Remediation Operator                           stable
serverless-operator                           Red Hat OpenShift Serverless                             stable
service-registry-operator                     Red Hat build of Apicurio Registry                       2.x
servicemeshoperator                           Red Hat OpenShift Service Mesh                           stable
skupper-operator                              Red Hat Service Interconnect                             stable
smb-csi-driver-operator                       CIFS/SMB CSI Driver Operator                             preview
sriov-network-operator                        SR-IOV Network Operator                                  stable
submariner                                    Submariner                                               stable-0.18
tang-operator                                 NBDE Tang Server                                         alpha
tempo-product                                 Tempo Operator                                           stable
topology-aware-lifecycle-manager              Topology Aware Lifecycle Manager                         stable
vertical-pod-autoscaler                       VerticalPodAutoscaler                                    stable
volsync-product                               VolSync                                                  stable
web-terminal                                  Web Terminal                                             fast
```

`3scale-operator` の情報を取得してみます。
```shell
$ oc mirror list operators --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.16 --package=3scale-operator
NAME             DISPLAY NAME                  DEFAULT CHANNEL
3scale-operator  Red Hat Integration - 3scale  threescale-2.14

PACKAGE          CHANNEL          HEAD
3scale-operator  threescale-2.13  3scale-operator.v0.10.5
3scale-operator  threescale-2.14  3scale-operator.v0.11.12
3scale-operator  threescale-mas   3scale-operator.v0.11.8-mas
```
更に `--channel` に `threescale-mas` を指定して詳細を見てみます。

```shell
$ oc mirror list operators --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.16 --package=3scale-operator --channel=threescale-mas
VERSIONS
0.11.1-mas
0.11.7-mas
0.11.2-mas
0.11.3-mas
0.11.5-mas
0.11.6-mas
0.11.8-mas
0.10.0-mas
0.11.0-mas
```

このように、非常に簡単に OperatorHub / Operator の各種情報を取得することが出来ます。