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-operators1 spec: priority: 10002 source: image: pollIntervalMinutes: 103 ref: registry.redhat.io/redhat/community-operator-index:v4.204 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.20 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: Succeeded2 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:11627ea6fdd06b8092df815076e03cae9b7cede8b353c0b461328842d02896c53 Type: Image Urls: Base: https://catalogd-service.openshift-catalogd.svc/catalogs/my-redhat-operators Events: <none>