4.3. カタログの管理
クラスター管理者は、カタログ、つまり Operator と Kubernetes 拡張機能の厳選されたコレクションをクラスターに追加できます。Operator の作成者は、自社の製品をこれらのカタログに公開します。クラスターにカタログを追加すると、カタログに公開されている Operator と拡張機能のバージョン、パッチ、無線更新にアクセスできるようになります。
カスタムリソース (CR) を使用して、CLI からカタログと拡張機能を宣言的に管理できます。
ファイルベースのカタログは、Operator Lifecycle Manager(OLM) のカタログ形式の最新の反復になります。この形式は、プレーンテキストベース (JSON または YAML) であり、以前の SQLite データベース形式の宣言的な設定の進化であり、完全な下位互換性があります。
Kubernetes は定期的に特定の API を非推奨とし、後続のリリースで削除します。その結果、Operator は API を削除した Kubernetes バージョンを使用する OpenShift Container Platform のバージョン以降、削除された API を使用できなくなります。
クラスターがカスタムカタログを使用している場合に、Operator の作成者がプロジェクトを更新してワークロードの問題や、互換性のないアップグレードを回避できるようにする方法は Operator の互換性の OpenShift Container Platform バージョンへの制御 を参照してください。
4.3.1. OLM v1 のカタログについて
catalogd コンポーネントを使用して、Operator やコントローラーなどの Kubernetes 拡張機能のカタログをクエリーすることで、インストール可能なコンテンツを検出できます。catalogd は、クラスター上のクライアント用にカタログコンテンツを展開する Kubernetes 機能拡張であり、マイクロサービスの Operator Lifecycle Manager (OLM) v1 スイートの一部です。現在、catalogd は、コンテナーイメージとしてパッケージ化および配布されているカタログコンテンツを解凍します。
関連情報
4.3.2. OLM v1 で Red Hat が提供する Operator カタログ
Operator Lifecycle Manager (OLM) v1 には、デフォルトでクラスター上に次の Red Hat 提供の Operator カタログが含まれています。クラスターにカタログを追加する場合は、カタログのカスタムリソース (CR) を作成し、クラスターに適用します。次のカスタムリソース (CR) の例は、クラスターにインストールされているデフォルトのカタログを示しています。
Red Hat Operator カタログ
apiVersion: olm.operatorframework.io/v1
kind: ClusterCatalog
metadata:
name: openshift-redhat-operators
spec:
priority: -100
source:
image:
pollIntervalMinutes: <poll_interval_duration> 1
ref: registry.redhat.io/redhat/redhat-operator-index:v4.18
type: Image
- 1
- 新しいイメージダイジェストを確認するためにリモートレジストリーでポーリングする間隔を分単位で指定します。ポーリングを無効にする場合は、フィールドを設定しないでください。
Certified Operators カタログ
apiVersion: olm.operatorframework.io/v1 kind: ClusterCatalog metadata: name: openshift-certified-operators spec: priority: -200 source: type: image image: pollIntervalMinutes: 10 ref: registry.redhat.io/redhat/certified-operator-index:v4.18 type: Image
Red Hat Marketplace カタログ
apiVersion: olm.operatorframework.io/v1 kind: ClusterCatalog metadata: name: openshift-redhat-marketplace spec: priority: -300 source: image: pollIntervalMinutes: 10 ref: registry.redhat.io/redhat/redhat-marketplace-index:v4.18 type: Image
Community Operators カタログ
apiVersion: olm.operatorframework.io/v1 kind: ClusterCatalog metadata: name: openshift-community-operators spec: priority: -400 source: image: pollIntervalMinutes: 10 ref: registry.redhat.io/redhat/community-operator-index:v4.18 type: Image
次のコマンドは、クラスターにカタログを追加します。
コマンド構文
$ oc apply -f <catalog_name>.yaml 1
- 1
my-catalog.yaml
などのカタログ CR を指定します。
4.3.3. クラスターへのカタログの追加
Operator Lifecycle Manager (OLM) v1 を使用するためにクラスターにカタログを追加するには、ClusterCatalog
カスタムリソース (CR) を作成し、それをクラスターに適用します。
手順
次の例のようなカタログカスタムリソース (CR) を作成します。
my-redhat-operators.yaml
ファイルの例apiVersion: olm.operatorframework.io/v1 kind: ClusterCatalog metadata: name: my-redhat-operators 1 spec: priority: 1000 2 source: image: pollIntervalMinutes: 10 3 ref: registry.redhat.io/redhat/community-operator-index:v4.18 4 type: Image
- 1
- カタログは、クラスターに適用されると、
metadata.name
フィールドの値で自動的にラベル付けされます。ラベルとカタログの選択の詳細は、「カタログコンテンツの解決」を参照してください。 - 2
- オプション: クラスター上の他のカタログに対するカタログの優先度を指定します。詳細は、「優先度によるカタログの選択」を参照してください。
- 3
- 新しいイメージダイジェストを確認するためにリモートレジストリーでポーリングする間隔を分単位で指定します。ポーリングを無効にする場合は、フィールドを設定しないでください。
- 4
spec.source.image.ref
フィールドにカタログのイメージを指定します。
次のコマンドを実行して、カタログをクラスターに追加します。
$ oc apply -f my-redhat-operators.yaml
出力例
clustercatalog.olm.operatorframework.io/my-redhat-operators created
検証
次のコマンドを実行して、カタログのステータスを確認します。
次のコマンドを実行して、カタログが利用可能かどうかを確認します。
$ oc get clustercatalog
出力例
NAME LASTUNPACKED SERVING AGE my-redhat-operators 55s True 64s openshift-certified-operators 83m True 84m openshift-community-operators 43m True 84m openshift-redhat-marketplace 83m True 84m openshift-redhat-operators 54m True 84m
次のコマンドを実行して、カタログのステータスを確認します。
$ oc describe clustercatalog my-redhat-operators
出力例
Name: my-redhat-operators Namespace: Labels: olm.operatorframework.io/metadata.name=my-redhat-operators Annotations: <none> API Version: olm.operatorframework.io/v1 Kind: ClusterCatalog Metadata: Creation Timestamp: 2025-02-18T20:28:50Z Finalizers: olm.operatorframework.io/delete-server-cache Generation: 1 Resource Version: 50248 UID: 86adf94f-d2a8-4e70-895b-31139f2eeab7 Spec: Availability Mode: Available Priority: 1000 Source: Image: Poll Interval Minutes: 10 Ref: registry.redhat.io/redhat/community-operator-index:v4.18 Type: Image Status: 1 Conditions: Last Transition Time: 2025-02-18T20:29:00Z Message: Successfully unpacked and stored content from resolved source Observed Generation: 1 Reason: Succeeded 2 Status: True Type: Progressing Last Transition Time: 2025-02-18T20:29:00Z Message: Serving desired content from resolved source Observed Generation: 1 Reason: Available Status: True Type: Serving Last Unpacked: 2025-02-18T20:28:59Z Resolved Source: Image: Ref: registry.redhat.io/redhat/community-operator-index@sha256:11627ea6fdd06b8092df815076e03cae9b7cede8b353c0b461328842d02896c5 3 Type: Image Urls: Base: https://catalogd-service.openshift-catalogd.svc/catalogs/my-redhat-operators Events: <none>
4.3.4. カタログの削除
カタログを削除するには、そのカスタムリソース (CR) を削除します。
前提条件
- カタログがインストールされています。
手順
次のコマンドを実行してカタログを削除します。
$ oc delete clustercatalog <catalog_name>
出力例
clustercatalog.olm.operatorframework.io "my-redhat-operators" deleted
検証
次のコマンドを実行して、カタログが削除されたことを確認します。
$ oc get clustercatalog
4.3.5. デフォルトのカタログの無効化
OpenShift Container Platform にデフォルトで含まれている Red Hat 提供のカタログを無効にできます。
手順
次のコマンドを実行して、デフォルトのカタログを無効にします。
$ oc patch clustercatalog openshift-certified-operators -p \ '{"spec": {"availabilityMode": "Unavailable"}}' --type=merge
出力例
clustercatalog.olm.operatorframework.io/openshift-certified-operators patched
検証
次のコマンドを実行して、カタログが無効になっていることを確認します。
$ oc get clustercatalog openshift-certified-operators
出力例
NAME LASTUNPACKED SERVING AGE openshift-certified-operators False 6h54m