第5章 クラスター拡張機能


5.1. クラスター拡張機能の管理

カタログがクラスターに追加されると、カタログに公開されている拡張機能と Operator のバージョン、パッチ、OTA (over-the-air) 更新にアクセスできるようになります。

カスタムリソース (CR) を使用して、CLI から拡張機能を宣言的に管理できます。

注記

OpenShift Container Platform 4.18 の場合、OLM v1 の文書化された手順は CLI ベースです。別の方法として、管理者は、Import YAML ページや Search ページなどの通常の方法を使用して、Web コンソールで関連オブジェクトを作成および表示することもできます。ただし、既存の OperatorHub および Installed Operators ページには OLM v1 コンポーネントがまだ表示されません。

5.1.1. サポートされる拡張機能

現在、Operator Lifecycle Manager (OLM) v1 は、次のすべての条件を満たすクラスター拡張機能のインストールをサポートしています。

  • 拡張機能では、OLM (Classic) で導入された registry+v1 バンドル形式を使用する必要があります。
  • 拡張機能は、AllNamespaces インストールモードによるインストールをサポートする必要があります。
  • 拡張機能は Webhook を使用してはなりません。
  • 拡張機能は、次に示すいずれかのファイルベースのカタログプロパティーを使用して依存関係を宣言してはなりません。

    • olm.gvk.required
    • olm.package.required
    • olm.constraint

OLM v1 は、インストールする拡張機能がこれらの制約を満たしているかどうかを確認します。インストールする拡張機能がこれらの制約を満たしていない場合、クラスター拡張機能の条件にエラーメッセージが出力されます。

重要

Operator Lifecycle Manager (OLM) v1 は、OLM (Classic) で導入された OperatorConditions API をサポートしていません。

拡張機能が OperatorConditions API のみに依存して更新を管理している場合、拡張機能が正しくインストールされない可能性があります。この API に依存する拡張機能のほとんどは起動時に失敗しますが、一部は調整中に失敗する可能性があります。

回避策として、拡張機能を特定のバージョンに固定できます。拡張機能を更新する場合は、拡張機能のドキュメントを参照して、いつ拡張機能を新しいバージョンに固定すれば安全か確認してください。

5.1.2. カタログからインストールする Operator を見つける

クラスターにカタログを追加した後、カタログにクエリーを実行して、インストールする Operator と拡張機能を見つけることができます。

現在、Operator Lifecycle Manager (OLM) v1 では、catalogd によって管理されるクラスター上のカタログをクエリーすることはできません。OLM v1 では、カタログレジストリーをクエリーするには、opm および jq CLI ツールを使用する必要があります。

前提条件

  • クラスターにカタログを追加している。
  • jq CLI ツールがインストールされている。
  • opm がインストールされている。

手順

  1. AllNamespaces インストールモードをサポートし、Webhook を使用しない拡張機能のリストを返すには、次のコマンドを入力します。

    $ opm render <catalog_registry_url>:<tag> \
      | jq -cs '[.[] | select(.schema == "olm.bundle" \
      and (.properties[] | select(.type == "olm.csv.metadata").value.installModes[] \
      | select(.type == "AllNamespaces" and .supported == true)) \
      and .spec.webhookdefinitions == null) | .package] | unique[]'
    Copy to Clipboard Toggle word wrap

    ここでは、以下のようになります。

    catalog_registry_url
    カタログレジストリーの URL (registry.redhat.io/redhat/redhat-operator-index など) を指定します。
    tag

    カタログのタグまたはバージョン (v4.18latest など) を指定します。

    例5.1 コマンドの例

    $ opm render \
      registry.redhat.io/redhat/redhat-operator-index:v4.18 \
      | jq -cs '[.[] | select(.schema == "olm.bundle" \
      and (.properties[] | select(.type == "olm.csv.metadata").value.installModes[] \
      | select(.type == "AllNamespaces" and .supported == true)) \
      and .spec.webhookdefinitions == null) | .package] | unique[]'
    Copy to Clipboard Toggle word wrap

    例5.2 出力例

    "3scale-operator"
    "amq-broker-rhel8"
    "amq-online"
    "amq-streams"
    "amq-streams-console"
    "ansible-automation-platform-operator"
    "ansible-cloud-addons-operator"
    "apicast-operator"
    "authorino-operator"
    "aws-load-balancer-operator"
    "bamoe-kogito-operator"
    "cephcsi-operator"
    "cincinnati-operator"
    "cluster-logging"
    "cluster-observability-operator"
    "compliance-operator"
    "container-security-operator"
    "cryostat-operator"
    "datagrid"
    "devspaces"
    ...
    Copy to Clipboard Toggle word wrap
  2. 次のコマンドを実行して、拡張機能のメタデータの内容を検査します。

    $ opm render <catalog_registry_url>:<tag> \
      | jq -s '.[] | select( .schema == "olm.package") \
      | select( .name == "<package_name>")'
    Copy to Clipboard Toggle word wrap

    例5.3 コマンドの例

    $ opm render \
      registry.redhat.io/redhat/redhat-operator-index:v4.18 \
      | jq -s '.[] | select( .schema == "olm.package") \
      | select( .name == "openshift-pipelines-operator-rh")'
    Copy to Clipboard Toggle word wrap

    例5.4 出力例

    {
      "schema": "olm.package",
      "name": "openshift-pipelines-operator-rh",
      "defaultChannel": "latest",
      "icon": {
        "base64data": "iVBORw0KGgoAAAANSUhE...",
        "mediatype": "image/png"
      }
    }
    Copy to Clipboard Toggle word wrap

5.1.2.1. 一般的なカタログクエリー

opm および jq CLI ツールを使用してカタログをクエリーできます。次の表は、拡張機能のインストール、更新、およびライフサイクルの管理時に使用できる一般的なカタログクエリーを示しています。

コマンド構文

$ opm render <catalog_registry_url>:<tag> | <jq_request>
Copy to Clipboard Toggle word wrap

ここでは、以下のようになります。

catalog_registry_url
カタログレジストリーの URL (registry.redhat.io/redhat/redhat-operator-index など) を指定します。
tag
カタログのタグまたはバージョン (v4.18latest など) を指定します。
jq_request
カタログで実行するクエリーを指定します。

例5.5 コマンドの例

$ opm render \
  registry.redhat.io/redhat/redhat-operator-index:v4.18 \
  | jq -cs '[.[] | select(.schema == "olm.bundle" and (.properties[] \
  | select(.type == "olm.csv.metadata").value.installModes[] \
  | select(.type == "AllNamespaces" and .supported == true)) \
  and .spec.webhookdefinitions == null) \
  | .package] | unique[]'
Copy to Clipboard Toggle word wrap
Expand
表5.1 一般的なパッケージクエリー
クエリーRequest

カタログで利用可能なパッケージ

$ opm render <catalog_registry_url>:<tag> \
  | jq -s '.[] | select( .schema == "olm.package")'
Copy to Clipboard Toggle word wrap

AllNamespaces インストールモードをサポートし、Webhook を使用しないパッケージ

$ opm render <catalog_registry_url>:<tag> \
  | jq -cs '[.[] | select(.schema == "olm.bundle" and (.properties[] \
  | select(.type == "olm.csv.metadata").value.installModes[] \
  | select(.type == "AllNamespaces" and .supported == true)) \
  and .spec.webhookdefinitions == null) \
  | .package] | unique[]'
Copy to Clipboard Toggle word wrap

パッケージのメタデータ

$ opm render <catalog_registry_url>:<tag> \
  | jq -s '.[] | select( .schema == "olm.package") \
  | select( .name == "<package_name>")'
Copy to Clipboard Toggle word wrap

パッケージ内のカタログブロブ

$ opm render <catalog_registry_url>:<tag> \
  | jq -s '.[] | select( .package == "<package_name>")'
Copy to Clipboard Toggle word wrap
Expand
表5.2 一般的なチャネルクエリー
クエリーRequest

パッケージのチャネル

$ opm render <catalog_registry_url>:<tag> \
  | jq -s '.[] | select( .schema == "olm.channel" ) \
  | select( .package == "<package_name>") | .name'
Copy to Clipboard Toggle word wrap

チャネル内のバージョン

$ opm render <catalog_registry_url>:<tag> \
  | jq -s '.[] | select( .package == "<package_name>" ) \
  | select( .schema == "olm.channel" ) \
  | select( .name == "<channel_name>" ) .entries \
  | .[] | .name'
Copy to Clipboard Toggle word wrap
  • チャネルの最新バージョン
  • アップグレードパス
$ opm render <catalog_registry_url>:<tag> \
  | jq -s '.[] | select( .schema == "olm.channel" ) \
  | select ( .name == "<channel_name>") \
  | select( .package == "<package_name>")'
Copy to Clipboard Toggle word wrap
Expand
表5.3 一般的なバンドルクエリー
クエリーRequest

パッケージ内のバンドル

$ opm render <catalog_registry_url>:<tag> \
  | jq -s '.[] | select( .schema == "olm.bundle" ) \
  | select( .package == "<package_name>") | .name'
Copy to Clipboard Toggle word wrap
  • 依存関係をバンドルする
  • 利用可能な API
$ opm render <catalog_registry_url>:<tag> \
  | jq -s '.[] | select( .schema == "olm.bundle" ) \
  | select ( .name == "<bundle_name>") \
  | select( .package == "<package_name>")'
Copy to Clipboard Toggle word wrap

5.1.3. クラスター拡張機能の権限

Operator Lifecycle Manager (OLM) Classic では、クラスター管理者権限を持つ 1 つのサービスアカウントがすべてのクラスター拡張機能を管理します。

OLM v1 は、デフォルトで OLM (Classic) よりもセキュアになるように設計されています。OLM v1 は、拡張機能のカスタムリソース (CR) で指定されたサービスアカウントを使用してクラスター拡張機能を管理します。クラスター管理者は、クラスター拡張機能ごとにサービスアカウントを作成できます。そのため、管理者は最小権限の原則に従い、ロールベースのアクセス制御 (RBAC) だけを割り当ててその拡張機能をインストールおよび管理することができます。

各権限を、クラスターロールまたはロールのいずれかに追加する必要があります。その後、クラスターロールバインディングまたはロールバインディングを使用して、クラスターロールまたはロールをサービスアカウントにバインドする必要があります。

RBAC のスコープを、クラスターまたは namespace のいずれかに設定できます。権限のスコープをクラスターに設定するには、クラスターロールとクラスターロールバインディングを使用します。権限のスコープを namespace に設定するには、ロールとロールバインディングを使用します。権限のスコープをクラスターに設定するか、namespace に設定するかは、インストールして管理する拡張機能の設計によって異なります。

重要

次のサンプルマニフェストでは、手順を簡素化し、読みやすさを向上させるために、スコープをクラスターに設定した権限を使用します。クラスターではなく拡張機能の namespace にスコープを設定すると、一部の権限をさらに制限できます。

インストールされた拡張機能の新しいバージョンに追加の権限が必要な場合、OLM v1 はクラスター管理者がその権限を付与するまで更新プロセスを停止します。

5.1.3.1. namespace の作成

クラスター拡張機能をインストールして管理するためのサービスアカウントを作成する前に、namespace を作成する必要があります。

前提条件

  • cluster-admin 権限を持つアカウントを使用して OpenShift Container Platform クラスターにアクセスできる。

手順

  • 次のコマンドを実行して、インストールする拡張機能のサービスアカウント用の新しい namespace を作成します。

    $ oc adm new-project <new_namespace>
    Copy to Clipboard Toggle word wrap

5.1.3.2. 拡張機能のサービスアカウントの作成

クラスター拡張機能をインストール、管理、更新するには、サービスアカウントを作成する必要があります。

前提条件

  • cluster-admin 権限を持つアカウントを使用して OpenShift Container Platform クラスターにアクセスできる。

手順

  1. 次の例のように、サービスアカウントを作成します。

    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: <extension>-installer
      namespace: <namespace>
    Copy to Clipboard Toggle word wrap

    例5.6 extension-service-account.yaml ファイルの例

    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: pipelines-installer
      namespace: pipelines
    Copy to Clipboard Toggle word wrap
  2. 次のコマンドを実行してサービスアカウントを適用します。

    $ oc apply -f extension-service-account.yaml
    Copy to Clipboard Toggle word wrap

5.1.3.3. 拡張機能のバンドルマニフェストのダウンロード

opm CLI ツールを使用して、インストールする拡張機能のバンドルマニフェストをダウンロードします。任意の CLI ツールまたはテキストエディターを使用してマニフェストを表示し、拡張機能をインストールおよび管理するために必要な権限を確認します。

前提条件

  • cluster-admin 権限を持つアカウントを使用して OpenShift Container Platform クラスターにアクセスできる。
  • インストールする拡張機能を決定した。
  • opm がインストールされている。

手順

  1. 次のコマンドを実行して、インストールする拡張機能の利用可能なバージョンとイメージを確認します。

    $ opm render <registry_url>:<tag_or_version> | \
      jq -cs '.[] | select( .schema == "olm.bundle" ) | \
      select( .package == "<extension_name>") | \
      {"name":.name, "image":.image}'
    Copy to Clipboard Toggle word wrap

    例5.7 コマンドの例

    $ opm render registry.redhat.io/redhat/redhat-operator-index:v4.18 | \
      jq -cs '.[] | select( .schema == "olm.bundle" ) | \
      select( .package == "openshift-pipelines-operator-rh") | \
      {"name":.name, "image":.image}'
    Copy to Clipboard Toggle word wrap

    例5.8 出力例

    {"name":"openshift-pipelines-operator-rh.v1.14.3","image":"registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:3f64b29f6903981470d0917b2557f49d84067bccdba0544bfe874ec4412f45b0"}
    {"name":"openshift-pipelines-operator-rh.v1.14.4","image":"registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:dd3d18367da2be42539e5dde8e484dac3df33ba3ce1d5bcf896838954f3864ec"}
    {"name":"openshift-pipelines-operator-rh.v1.14.5","image":"registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:f7b19ce26be742c4aaa458d37bc5ad373b5b29b20aaa7d308349687d3cbd8838"}
    {"name":"openshift-pipelines-operator-rh.v1.15.0","image":"registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:22be152950501a933fe6e1df0e663c8056ca910a89dab3ea801c3bb2dc2bf1e6"}
    {"name":"openshift-pipelines-operator-rh.v1.15.1","image":"registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:64afb32e3640bb5968904b3d1a317e9dfb307970f6fda0243e2018417207fd75"}
    {"name":"openshift-pipelines-operator-rh.v1.15.2","image":"registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:8a593c1144709c9aeffbeb68d0b4b08368f528e7bb6f595884b2474bcfbcafcd"}
    {"name":"openshift-pipelines-operator-rh.v1.16.0","image":"registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:a46b7990c0ad07dae78f43334c9bd5e6cba7b50ca60d3f880099b71e77bed214"}
    {"name":"openshift-pipelines-operator-rh.v1.16.1","image":"registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:29f27245e93b3f605647993884751c490c4a44070d3857a878d2aee87d43f85b"}
    {"name":"openshift-pipelines-operator-rh.v1.16.2","image":"registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:2037004666526c90329f4791f14cb6cc06e8775cb84ba107a24cc4c2cf944649"}
    {"name":"openshift-pipelines-operator-rh.v1.17.0","image":"registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:d75065e999826d38408049aa1fde674cd1e45e384bfdc96523f6bad58a0e0dbc"}
    Copy to Clipboard Toggle word wrap
  2. 次のコマンドを実行して、インストールするバンドルのイメージを抽出するディレクトリーを作成します。

    $ mkdir <new_dir>
    Copy to Clipboard Toggle word wrap
  3. 次のコマンドを実行してそのディレクトリーに移動します。

    $ cd <new_dir>
    Copy to Clipboard Toggle word wrap
  4. インストールするバージョンのイメージ参照を見つけて、次のコマンドを実行します。

    $ oc image extract <full_path_to_registry_image>@sha256:<sha>
    Copy to Clipboard Toggle word wrap

    コマンドの例

    $ oc image extract registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:f7b19ce26be742c4aaa458d37bc5ad373b5b29b20aaa7d308349687d3cbd8838
    Copy to Clipboard Toggle word wrap

  5. 次のコマンドを実行して、manifests ディレクトリーに移動します。

    $ cd manifests
    Copy to Clipboard Toggle word wrap
  6. 次のコマンドを入力して、マニフェストディレクトリーの内容を表示します。出力には、拡張機能のインストール、管理、および操作に必要なリソースのマニフェストがリストされます。

    $ tree
    Copy to Clipboard Toggle word wrap

    例5.9 出力例

    .
    ├── manifests
    │   ├── config-logging_v1_configmap.yaml
    │   ├── openshift-pipelines-operator-monitor_monitoring.coreos.com_v1_servicemonitor.yaml
    │   ├── openshift-pipelines-operator-prometheus-k8s-read-binding_rbac.authorization.k8s.io_v1_rolebinding.yaml
    │   ├── openshift-pipelines-operator-read_rbac.authorization.k8s.io_v1_role.yaml
    │   ├── openshift-pipelines-operator-rh.clusterserviceversion.yaml
    │   ├── operator.tekton.dev_manualapprovalgates.yaml
    │   ├── operator.tekton.dev_openshiftpipelinesascodes.yaml
    │   ├── operator.tekton.dev_tektonaddons.yaml
    │   ├── operator.tekton.dev_tektonchains.yaml
    │   ├── operator.tekton.dev_tektonconfigs.yaml
    │   ├── operator.tekton.dev_tektonhubs.yaml
    │   ├── operator.tekton.dev_tektoninstallersets.yaml
    │   ├── operator.tekton.dev_tektonpipelines.yaml
    │   ├── operator.tekton.dev_tektonresults.yaml
    │   ├── operator.tekton.dev_tektontriggers.yaml
    │   ├── tekton-config-defaults_v1_configmap.yaml
    │   ├── tekton-config-observability_v1_configmap.yaml
    │   ├── tekton-config-read-rolebinding_rbac.authorization.k8s.io_v1_clusterrolebinding.yaml
    │   ├── tekton-config-read-role_rbac.authorization.k8s.io_v1_clusterrole.yaml
    │   ├── tekton-operator-controller-config-leader-election_v1_configmap.yaml
    │   ├── tekton-operator-info_rbac.authorization.k8s.io_v1_rolebinding.yaml
    │   ├── tekton-operator-info_rbac.authorization.k8s.io_v1_role.yaml
    │   ├── tekton-operator-info_v1_configmap.yaml
    │   ├── tekton-operator_v1_service.yaml
    │   ├── tekton-operator-webhook-certs_v1_secret.yaml
    │   ├── tekton-operator-webhook-config-leader-election_v1_configmap.yaml
    │   ├── tekton-operator-webhook_v1_service.yaml
    │   ├── tekton-result-read-rolebinding_rbac.authorization.k8s.io_v1_clusterrolebinding.yaml
    │   └── tekton-result-read-role_rbac.authorization.k8s.io_v1_clusterrole.yaml
    ├── metadata
    │   ├── annotations.yaml
    │   └── properties.yaml
    └── root
        └── buildinfo
            ├── content_manifests
            │   └── openshift-pipelines-operator-bundle-container-v1.16.2-3.json
            └── Dockerfile-openshift-pipelines-pipelines-operator-bundle-container-v1.16.2-3
    Copy to Clipboard Toggle word wrap

次のステップ

  • 任意の CLI ツールまたはテキストエディターを使用して、manifests ディレクトリーにあるクラスターサービスバージョン (CSV) ファイルの install.spec.clusterpermissions スタンザの内容を表示します。次の例では、Red Hat OpenShift Pipelines Operator の openshift-pipelines-operator-rh.clusterserviceversion.yaml ファイルを参照します。
  • 次の手順でクラスターロールファイルに権限を割り当てるときに、このファイルを参照できるように開いたままにしておきます。

5.1.3.4. クラスター拡張機能をインストールおよび管理するために必要な権限

必要な権限を割り当てるには、クラスター拡張機能のバンドルイメージに含まれるマニフェストを確認する必要があります。次のリソースを作成および管理するのに十分なロールベースのアクセス制御 (RBAC) がサービスアカウントに必要です。

重要

実行に必要な最小限の RBAC を使用して、特定のリソース名に対する最小権限とスコープ権限の原則を遵守してください。

アドミッションプラグイン
OpenShift Container Platform クラスターは OwnerReferencesPermissionEnforcement アドミッションプラグインを使用します。そのため、クラスター拡張機能には blockOwnerDeletion および ownerReferences ファイナライザーを更新する権限が必要です。
拡張機能のコントローラー用のクラスターロールとクラスターロールバインディング
拡張機能のコントローラー用のクラスターロールとクラスターロールバインディングを、インストールサービスアカウントが作成および管理できるように、RBAC を定義する必要があります。
クラスターサービスバージョン (CSV)
クラスター拡張機能の CSV で定義されたリソース用の RBAC を定義する必要があります。
クラスタースコープのバンドルリソース
バンドルに含まれるクラスタースコープのリソースを作成および管理するための RBAC を定義する必要があります。クラスタースコープのリソースが ClusterRole などの別のリソースタイプと一致する場合は、resources または resourceNames フィールドの下にある既存のルールにリソースを追加できます。
カスタムリソース定義 (CRD)
インストールサービスアカウントが拡張機能の CRD を作成および管理できるように、RBAC を定義する必要があります。また、拡張機能のコントローラーのサービスアカウントに、拡張機能の CRD を管理するための RBAC を付与する必要があります。
デプロイメント
service や config map など、拡張機能のコントローラーに必要なデプロイメントを作成および管理するために、インストールサービスアカウント用の RBAC を定義する必要があります。
拡張機能の権限
CSV で定義されている権限とクラスター権限用の RBAC を含める必要があります。インストールサービスアカウントが、これらの権限を拡張機能コントローラーに付与できる必要があります。これらの権限は、拡張機能コントローラーの実行に必要です。
namespace スコープのバンドルリソース
namespace スコープのバンドルリソース用の RBAC を定義する必要があります。インストールサービスアカウントに、config map や service などのリソースを作成および管理するための権限が必要です。
ロールおよびロールバインディング
CSV で定義されているすべてのロールまたはロールバインディング用の RBAC を定義する必要があります。インストールサービスアカウントに、これらのロールとロールバインディングを作成および管理するための権限が必要です。
サービスアカウント
インストールサービスアカウントが拡張機能のコントローラーのサービスアカウントを作成および管理できるように、RBAC を定義する必要があります。

5.1.3.5. 拡張機能用のクラスターロールの作成

インストールする拡張機能に必要なロールベースのアクセス制御 (RBAC) を定義するには、クラスターサービスバージョン (CSV) の install.spec.clusterpermissions スタンザと拡張機能のマニフェストをよく確認する必要があります。必要な RBAC を CSV から新しいマニフェストにコピーして、クラスターロールを作成する必要があります。

ヒント

OLM v1 で拡張機能をインストールおよび更新するプロセスをテストする場合は、次のクラスターロールを使用すると、クラスター管理者の権限を付与できます。このマニフェストはテストのみを目的としたものです。実稼働クラスターでは使用しないでください。

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: <extension>-installer-clusterrole
rules:
- apiGroups: ["*"]
  resources: ["*"]
  verbs: ["*"]
Copy to Clipboard Toggle word wrap

次の手順では、Red Hat OpenShift Pipelines Operator の openshift-pipelines-operator-rh.clusterserviceversion.yaml ファイルを例として使用します。この例には、OpenShift Pipelines Operator をインストールおよび管理するために必要な RBAC の抜粋が含まれています。完全なマニフェストについては、「Red Hat OpenShift Pipelines Operator のクラスターロールの例」を参照してください。

重要

次のサンプルマニフェストでは、手順を簡素化し、読みやすさを向上させるために、スコープをクラスターに設定した権限を使用します。クラスターではなく拡張機能の namespace にスコープを設定すると、一部の権限をさらに制限できます。

前提条件

  • cluster-admin 権限を持つアカウントを使用して OpenShift Container Platform クラスターにアクセスできる。
  • インストールする拡張機能のイメージ参照のマニフェストをダウンロードした。

手順

  1. 次の例のように、新しいクラスターロールマニフェストを作成します。

    <extension>-cluster-role.yaml ファイルの例

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      name: <extension>-installer-clusterrole
    Copy to Clipboard Toggle word wrap

  2. 次の例のように、クラスターロールマニフェストを編集し、拡張機能のファイナライザーを更新する権限を含めます。

    <extension>-cluster-role.yaml の例

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      name: pipelines-installer-clusterrole
    rules:
    - apiGroups:
      - olm.operatorframework.io
      resources:
      - clusterextensions/finalizers
      verbs:
      - update
      # Scoped to the name of the ClusterExtension
      resourceNames:
      - <metadata_name> 
    1
    Copy to Clipboard Toggle word wrap

    1
    拡張機能のカスタムリソース (CR) の metadata.name フィールド値を指定します。
  3. 拡張機能の CSV ファイルの rules.resources フィールドで clusterrole および clusterrolebindings の値を検索します。

    • 次の例のように、API グループ、リソース、動詞、およびリソース名をマニフェストにコピーします。

      クラスターロールマニフェストの例

      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: pipelines-installer-clusterrole
      rules:
      # ...
      # ClusterRoles and ClusterRoleBindings for the controllers of the extension
      - apiGroups:
        - rbac.authorization.k8s.io
        resources:
        - clusterroles
        verbs:
        - create 
      1
      
        - list
        - watch
      - apiGroups:
        - rbac.authorization.k8s.io
        resources:
        - clusterroles
        verbs:
        - get
        - update
        - patch
        - delete
        resourceNames: 
      2
      
        - "*"
      - apiGroups:
        - rbac.authorization.k8s.io
        resources:
        - clusterrolebindings
        verbs:
        - create
        - list
        - watch
      - apiGroups:
        - rbac.authorization.k8s.io
        resources:
        - clusterrolebindings
        verbs:
        - get
        - update
        - patch
        - delete
        resourceNames:
        - "*"
      # ...
      Copy to Clipboard Toggle word wrap

      1
      createlist、および watch 権限のスコープを、特定のリソース名 (resourceNames フィールド) に設定することはできません。これらの権限のスコープは、リソース (resources フィールド) に設定する必要があります。
      2
      一部のリソース名は、<package_name>.<hash> という形式を使用して生成されます。拡張機能をインストールした後、拡張機能のコントローラーのクラスターロールとクラスターロールバインディングのリソース名を検索してください。この例のワイルドカード文字を生成された名前に置き換え、最小権限の原則を遵守してください。
  4. 拡張機能の CSV ファイルの rules.resources フィールドで customresourcedefinitions 値を検索します。

    • 次の例のように、API グループ、リソース、動詞、およびリソース名をマニフェストにコピーします。

      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: pipelines-installer-clusterrole
      rules:
      # ...
      # Custom resource definitions of the extension
      - apiGroups:
        - apiextensions.k8s.io
        resources:
        - customresourcedefinitions
        verbs:
        - create
        - list
        - watch
      - apiGroups:
        - apiextensions.k8s.io
        resources:
        - customresourcedefinitions
        verbs:
        - get
        - update
        - patch
        - delete
        resourceNames:
        - manualapprovalgates.operator.tekton.dev
        - openshiftpipelinesascodes.operator.tekton.dev
        - tektonaddons.operator.tekton.dev
        - tektonchains.operator.tekton.dev
        - tektonconfigs.operator.tekton.dev
        - tektonhubs.operator.tekton.dev
        - tektoninstallersets.operator.tekton.dev
        - tektonpipelines.operator.tekton.dev
        - tektonresults.operator.tekton.dev
        - tektontriggers.operator.tekton.dev
      # ...
      Copy to Clipboard Toggle word wrap
  5. CSV ファイルで、rules.resources 仕様の permissions および clusterPermissions 値が含まれるスタンザを検索します。

    • 次の例のように、API グループ、リソース、動詞、およびリソース名をマニフェストにコピーします。

      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: pipelines-installer-clusterrole
      rules:
      # ...
      # Excerpt from install.spec.clusterPermissions
      - apiGroups:
        - ''
        resources:
        - nodes
        - pods
        - services
        - endpoints
        - persistentvolumeclaims
        - events
        - configmaps
        - secrets
        - pods/log
        - limitranges
        verbs:
        - create
        - list
        - watch
        - delete
        - deletecollection
        - patch
        - get
        - update
      - apiGroups:
        - extensions
        - apps
        resources:
        - ingresses
        - ingresses/status
        verbs:
        - create
        - list
        - watch
        - delete
        - patch
        - get
        - update
       # ...
      Copy to Clipboard Toggle word wrap
  6. CSV ファイルで、install.spec.deployments スタンザの下のリソースを検索します。

    • 次の例のように、API グループ、リソース、動詞、およびリソース名をマニフェストにコピーします。

      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: pipelines-installer-clusterrole
      rules:
      # ...
      # Excerpt from install.spec.deployments
      - apiGroups:
        - apps
        resources:
        - deployments
        verbs:
        - create
        - list
        - watch
      - apiGroups:
        - apps
        resources:
        - deployments
        verbs:
        - get
        - update
        - patch
        - delete
        # scoped to the extension controller deployment name
        resourceNames:
        - openshift-pipelines-operator
        - tekton-operator-webhook
      # ...
      Copy to Clipboard Toggle word wrap
  7. 拡張機能の CSV ファイルの rules.resources フィールドで、services および configmaps 値を検索します。

    • 次の例のように、API グループ、リソース、動詞、およびリソース名をマニフェストにコピーします。

      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: pipelines-installer-clusterrole
      rules:
      # ...
      # Services
      - apiGroups:
        - ""
        resources:
        - services
        verbs:
        - create
      - apiGroups:
        - ""
        resources:
        - services
        verbs:
        - get
        - list
        - watch
        - update
        - patch
        - delete
        # scoped to the service name
        resourceNames:
        - openshift-pipelines-operator-monitor
        - tekton-operator
        - tekton-operator-webhook
      # configmaps
      - apiGroups:
        - ""
        resources:
        - configmaps
        verbs:
        - create
      - apiGroups:
        - ""
        resources:
        - configmaps
        verbs:
        - get
        - list
        - watch
        - update
        - patch
        - delete
        # scoped to the configmap name
        resourceNames:
        - config-logging
        - tekton-config-defaults
        - tekton-config-observability
        - tekton-operator-controller-config-leader-election
        - tekton-operator-info
        - tekton-operator-webhook-config-leader-election
      - apiGroups:
        - operator.tekton.dev
        resources:
        - tekton-config-read-role
        - tekton-result-read-role
        verbs:
        - get
        - watch
        - list
      Copy to Clipboard Toggle word wrap
  8. 次のコマンドを実行して、クラスターロールマニフェストをクラスターに追加します。

    $ oc apply -f <extension>-installer-clusterrole.yaml
    Copy to Clipboard Toggle word wrap

    コマンドの例

    $ oc apply -f pipelines-installer-clusterrole.yaml
    Copy to Clipboard Toggle word wrap

5.1.3.6. Red Hat OpenShift Pipelines Operator のクラスターロールの例

OpenShift Pipelines Operator の完全なクラスターロールマニフェストについては、次の例を参照してください。

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: pipelines-installer-clusterrole
rules:
- apiGroups:
  - olm.operatorframework.io
  resources:
  - clusterextensions/finalizers
  verbs:
  - update
  # Scoped to the name of the ClusterExtension
  resourceNames:
  - pipes # the value from <metadata.name> from the extension's custom resource (CR)
# ClusterRoles and ClusterRoleBindings for the controllers of the extension
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - clusterroles
  verbs:
  - create
  - list
  - watch
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - clusterroles
  verbs:
  - get
  - update
  - patch
  - delete
  resourceNames:
  - "*"
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - clusterrolebindings
  verbs:
  - create
  - list
  - watch
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - clusterrolebindings
  verbs:
  - get
  - update
  - patch
  - delete
  resourceNames:
  - "*"
# Extension's custom resource definitions
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  verbs:
  - create
  - list
  - watch
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  verbs:
  - get
  - update
  - patch
  - delete
  resourceNames:
  - manualapprovalgates.operator.tekton.dev
  - openshiftpipelinesascodes.operator.tekton.dev
  - tektonaddons.operator.tekton.dev
  - tektonchains.operator.tekton.dev
  - tektonconfigs.operator.tekton.dev
  - tektonhubs.operator.tekton.dev
  - tektoninstallersets.operator.tekton.dev
  - tektonpipelines.operator.tekton.dev
  - tektonresults.operator.tekton.dev
  - tektontriggers.operator.tekton.dev
- apiGroups:
  - ''
  resources:
  - nodes
  - pods
  - services
  - endpoints
  - persistentvolumeclaims
  - events
  - configmaps
  - secrets
  - pods/log
  - limitranges
  verbs:
  - create
  - list
  - watch
  - delete
  - deletecollection
  - patch
  - get
  - update
- apiGroups:
  - extensions
  - apps
  resources:
  - ingresses
  - ingresses/status
  verbs:
  - create
  - list
  - watch
  - delete
  - patch
  - get
  - update
- apiGroups:
  - ''
  resources:
  - namespaces
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - apps
  resources:
  - deployments
  - daemonsets
  - replicasets
  - statefulsets
  - deployments/finalizers
  verbs:
  - delete
  - deletecollection
  - create
  - patch
  - get
  - list
  - update
  - watch
- apiGroups:
  - monitoring.coreos.com
  resources:
  - servicemonitors
  verbs:
  - get
  - create
  - delete
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - clusterroles
  - roles
  verbs:
  - delete
  - deletecollection
  - create
  - patch
  - get
  - list
  - update
  - watch
  - bind
  - escalate
- apiGroups:
  - ''
  resources:
  - serviceaccounts
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
  - impersonate
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - clusterrolebindings
  - rolebindings
  verbs:
  - get
  - update
  - delete
  - patch
  - create
  - list
  - watch
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  - customresourcedefinitions/status
  verbs:
  - get
  - create
  - update
  - delete
  - list
  - patch
  - watch
- apiGroups:
  - admissionregistration.k8s.io
  resources:
  - mutatingwebhookconfigurations
  - validatingwebhookconfigurations
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - build.knative.dev
  resources:
  - builds
  - buildtemplates
  - clusterbuildtemplates
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - extensions
  resources:
  - deployments
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - extensions
  resources:
  - deployments/finalizers
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - operator.tekton.dev
  resources:
  - '*'
  - tektonaddons
  verbs:
  - delete
  - deletecollection
  - create
  - patch
  - get
  - list
  - update
  - watch
- apiGroups:
  - tekton.dev
  - triggers.tekton.dev
  - operator.tekton.dev
  - pipelinesascode.tekton.dev
  resources:
  - '*'
  verbs:
  - add
  - delete
  - deletecollection
  - create
  - patch
  - get
  - list
  - update
  - watch
- apiGroups:
  - dashboard.tekton.dev
  resources:
  - '*'
  - tektonaddons
  verbs:
  - delete
  - deletecollection
  - create
  - patch
  - get
  - list
  - update
  - watch
- apiGroups:
  - security.openshift.io
  resources:
  - securitycontextconstraints
  verbs:
  - use
  - get
  - list
  - create
  - update
  - delete
- apiGroups:
  - events.k8s.io
  resources:
  - events
  verbs:
  - create
- apiGroups:
  - route.openshift.io
  resources:
  - routes
  verbs:
  - delete
  - deletecollection
  - create
  - patch
  - get
  - list
  - update
  - watch
- apiGroups:
  - coordination.k8s.io
  resources:
  - leases
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - console.openshift.io
  resources:
  - consoleyamlsamples
  - consoleclidownloads
  - consolequickstarts
  - consolelinks
  verbs:
  - delete
  - deletecollection
  - create
  - patch
  - get
  - list
  - update
  - watch
- apiGroups:
  - autoscaling
  resources:
  - horizontalpodautoscalers
  verbs:
  - delete
  - create
  - patch
  - get
  - list
  - update
  - watch
- apiGroups:
  - policy
  resources:
  - poddisruptionbudgets
  verbs:
  - delete
  - deletecollection
  - create
  - patch
  - get
  - list
  - update
  - watch
- apiGroups:
  - monitoring.coreos.com
  resources:
  - servicemonitors
  verbs:
  - delete
  - deletecollection
  - create
  - patch
  - get
  - list
  - update
  - watch
- apiGroups:
  - batch
  resources:
  - jobs
  - cronjobs
  verbs:
  - delete
  - deletecollection
  - create
  - patch
  - get
  - list
  - update
  - watch
- apiGroups:
  - ''
  resources:
  - namespaces/finalizers
  verbs:
  - update
- apiGroups:
  - resolution.tekton.dev
  resources:
  - resolutionrequests
  - resolutionrequests/status
  verbs:
  - get
  - list
  - watch
  - create
  - delete
  - update
  - patch
- apiGroups:
  - console.openshift.io
  resources:
  - consoleplugins
  verbs:
  - get
  - list
  - watch
  - create
  - delete
  - update
  - patch
# Deployments specified in install.spec.deployments
- apiGroups:
  - apps
  resources:
  - deployments
  verbs:
  - create
  - list
  - watch
- apiGroups:
  - apps
  resources:
  - deployments
  verbs:
  - get
  - update
  - patch
  - delete
  # scoped to the extension controller deployment name
  resourceNames:
  - openshift-pipelines-operator
  - tekton-operator-webhook
# Service accounts in the CSV
- apiGroups:
  - ""
  resources:
  - serviceaccounts
  verbs:
  - create
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - serviceaccounts
  verbs:
  - get
  - update
  - patch
  - delete
  # scoped to the extension controller's deployment service account
  resourceNames:
  - openshift-pipelines-operator
# Services
- apiGroups:
  - ""
  resources:
  - services
  verbs:
  - create
- apiGroups:
  - ""
  resources:
  - services
  verbs:
  - get
  - list
  - watch
  - update
  - patch
  - delete
  # scoped to the service name
  resourceNames:
  - openshift-pipelines-operator-monitor
  - tekton-operator
  - tekton-operator-webhook
# configmaps
- apiGroups:
  - ""
  resources:
  - configmaps
  verbs:
  - create
- apiGroups:
  - ""
  resources:
  - configmaps
  verbs:
  - get
  - list
  - watch
  - update
  - patch
  - delete
  # scoped to the configmap name
  resourceNames:
  - config-logging
  - tekton-config-defaults
  - tekton-config-observability
  - tekton-operator-controller-config-leader-election
  - tekton-operator-info
  - tekton-operator-webhook-config-leader-election
- apiGroups:
  - operator.tekton.dev
  resources:
  - tekton-config-read-role
  - tekton-result-read-role
  verbs:
  - get
  - watch
  - list
---
Copy to Clipboard Toggle word wrap

5.1.3.7. 拡張機能用のクラスターロールバインディングの作成

サービスアカウントとクラスターロールを作成したら、クラスターロールバインディングマニフェストを使用して、クラスターロールをサービスアカウントにバインドする必要があります。

前提条件

  • cluster-admin 権限を持つアカウントを使用して OpenShift Container Platform クラスターにアクセスできる。
  • インストールする拡張機能用に、次のリソースを作成して適用した。

    • namespace
    • サービスアカウント
    • クラスターロール

手順

  1. 次の例のように、クラスターロールをサービスアカウントにバインドするためのクラスターロールバインディングを作成します。

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: <extension>-installer-binding
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: <extension>-installer-clusterrole
    subjects:
    - kind: ServiceAccount
      name: <extension>-installer
      namespace: <namespace>
    Copy to Clipboard Toggle word wrap

    例5.10 pipelines-cluster-role-binding.yaml ファイルの例

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: pipelines-installer-binding
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: pipelines-installer-clusterrole
    subjects:
    - kind: ServiceAccount
      name: pipelines-installer
      namespace: pipelines
    Copy to Clipboard Toggle word wrap
  2. 次のコマンドを実行して、クラスターロールバインディングを適用します。

    $ oc apply -f pipelines-cluster-role-binding.yaml
    Copy to Clipboard Toggle word wrap

5.1.4. カタログからのクラスター拡張機能のインストール

カスタムリソース (CR) を作成し、それをクラスターに適用することで、カタログから拡張機能をインストールできます。Operator Lifecycle Manager (OLM) v1 は、registry+v1 バンドル形式の OLM (Classic) Operator を含む、クラスタースコープのクラスター拡張機能のインストールをサポートしています。詳細は、サポートされている拡張機能 を参照してください。

注記

OpenShift Container Platform 4.18 の場合、OLM v1 の文書化された手順は CLI ベースです。別の方法として、管理者は、Import YAML ページや Search ページなどの通常の方法を使用して、Web コンソールで関連オブジェクトを作成および表示することもできます。ただし、既存の OperatorHub および Installed Operators ページには OLM v1 コンポーネントがまだ表示されません。

前提条件

  • サービスアカウントを作成し、インストールする拡張機能をインストール、更新、管理するのに十分なロールベースのアクセス制御 (RBAC) を割り当てた。詳細は、「クラスター拡張機能の権限」を参照してください。

手順

  1. 次の例のような CR を作成します。

    apiVersion: olm.operatorframework.io/v1
      kind: ClusterExtension
      metadata:
        name: <clusterextension_name>
      spec:
        namespace: <installed_namespace> 
    1
    
        serviceAccount:
          name: <service_account_installer_name> 
    2
    
        source:
          sourceType: Catalog
          catalog:
            packageName: <package_name>
            channels:
              - <channel_name> 
    3
    
            version: <version_or_version_range> 
    4
    
            upgradeConstraintPolicy: CatalogProvided 
    5
    Copy to Clipboard Toggle word wrap
    1
    pipelinesmy-extension など、バンドルをインストールする namespace を指定します。拡張機能は継続してクラスタースコープであり、異なる namespace にインストールされているリソースが含まれる可能性があります。
    2
    拡張機能をインストール、更新、管理するために作成したサービスアカウントの名前を指定します。
    3
    オプション: チャネル名を、pipelines-1.14latest などの配列の形で指定します。
    4
    オプション: インストールまたは更新するパッケージのバージョンまたはバージョン範囲 (1.14.01.14.x>=1.16 など) を指定します。詳細は、「ターゲットバージョンを指定するカスタムリソース (CR) の例」および「バージョン範囲のサポート」を参照してください。
    5
    オプション: アップグレード制約ポリシーを指定します。指定されていない場合、デフォルト設定は CatalogProvided になります。CatalogProvided 設定が更新されるのは、新しいバージョンがパッケージ作成者によって設定されたアップグレード制約を満たしている場合だけです。更新またはロールバックを強制するには、フィールドを SelfCertified に設定します。詳細は、「更新またはロールバックの強制」を参照してください。

pipelines-operator.yaml CR の例

apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
  name: pipelines-operator
spec:
  namespace: pipelines
  serviceAccount:
    name: pipelines-installer
  source:
    sourceType: Catalog
    catalog:
      packageName: openshift-pipelines-operator-rh
      version: "1.14.x"
Copy to Clipboard Toggle word wrap

  1. 次のコマンドを実行して、CR をクラスターに適用します。

    $ oc apply -f pipeline-operator.yaml
    Copy to Clipboard Toggle word wrap

    出力例

    clusterextension.olm.operatorframework.io/pipelines-operator created
    Copy to Clipboard Toggle word wrap

検証

  1. 次のコマンドを実行して、Operator または拡張機能の CR を YAML 形式で表示します。

    $ oc get clusterextension pipelines-operator -o yaml
    Copy to Clipboard Toggle word wrap

    例5.11 出力例

    apiVersion: v1
    items:
    - apiVersion: olm.operatorframework.io/v1
      kind: ClusterExtension
      metadata:
        annotations:
          kubectl.kubernetes.io/last-applied-configuration: |
            {"apiVersion":"olm.operatorframework.io/v1","kind":"ClusterExtension","metadata":{"annotations":{},"name":"pipes"},"spec":{"namespace":"pipelines","serviceAccount":{"name":"pipelines-installer"},"source":{"catalog":{"packageName":"openshift-pipelines-operator-rh","version":"1.14.x"},"sourceType":"Catalog"}}}
        creationTimestamp: "2025-02-18T21:48:13Z"
        finalizers:
        - olm.operatorframework.io/cleanup-unpack-cache
        - olm.operatorframework.io/cleanup-contentmanager-cache
        generation: 1
        name: pipelines-operator
        resourceVersion: "72725"
        uid: e18b13fb-a96d-436f-be75-a9a0f2b07993
      spec:
        namespace: pipelines
        serviceAccount:
          name: pipelines-installer
        source:
          catalog:
            packageName: openshift-pipelines-operator-rh
            upgradeConstraintPolicy: CatalogProvided
            version: 1.14.x
          sourceType: Catalog
      status:
        conditions:
        - lastTransitionTime: "2025-02-18T21:48:13Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: Deprecated
        - lastTransitionTime: "2025-02-18T21:48:13Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: PackageDeprecated
        - lastTransitionTime: "2025-02-18T21:48:13Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: ChannelDeprecated
        - lastTransitionTime: "2025-02-18T21:48:13Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: BundleDeprecated
        - lastTransitionTime: "2025-02-18T21:48:16Z"
          message: Installed bundle registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:f7b19ce26be742c4aaa458d37bc5ad373b5b29b20aaa7d308349687d3cbd8838
            successfully
          observedGeneration: 1
          reason: Succeeded
          status: "True"
          type: Installed
        - lastTransitionTime: "2025-02-18T21:48:16Z"
          message: desired state reached
          observedGeneration: 1
          reason: Succeeded
          status: "True"
          type: Progressing
        install:
          bundle:
            name: openshift-pipelines-operator-rh.v1.14.5
            version: 1.14.5
    kind: List
    metadata:
      resourceVersion: ""
    Copy to Clipboard Toggle word wrap

    ここでは、以下のようになります。

    spec.channel
    拡張の CR で定義されたチャネルを表示します。
    spec.version
    拡張の CR で定義されたバージョンまたはバージョン範囲を表示します。
    status.conditions
    拡張機能のステータスと健全性に関する情報を表示します。
    type: Deprecated

    次の 1 つ以上が非推奨かどうかを表示します。

    type: PackageDeprecated
    解決されたパッケージが非推奨かどうかを表示します。
    type: ChannelDeprecated
    解決されたチャネルが非推奨かどうかを表示します。
    type: BundleDeprecated
    解決されたバンドルが非推奨かどうかを表示します。

    status フィールドの False の値は reason: Deprecated 条件が非推奨ではないことを示します。ステータス フィールドの True の値は reason: Deprecated 条件が非推奨であることを示します。

    installedBundle.name
    インストールされているバンドルの名前を表示します。
    installedBundle.version
    インストールされているバンドルのバージョンを表示します。

5.1.5. クラスター拡張機能の更新

カスタムリソース (CR) を手動で編集し、変更を適用することで、クラスター拡張機能または Operator を更新できます。

前提条件

  • Operator または拡張機能がインストールされている。
  • jq CLI ツールがインストールされている。
  • opm がインストールされている。

手順

  1. 次の手順を実行して、カタログファイルのローカルコピーからパッケージのチャネルとバージョン情報を検査します。

    1. 次のコマンドを実行して、選択したパッケージからチャネルのリストを取得します。

      $ opm render <catalog_registry_url>:<tag> \
        | jq -s '.[] | select( .schema == "olm.channel" ) \
        | select( .package == "openshift-pipelines-operator-rh") | .name'
      Copy to Clipboard Toggle word wrap

      例5.12 コマンドの例

      $ opm render registry.redhat.io/redhat/redhat-operator-index:v4.18 \
        | jq -s '.[] | select( .schema == "olm.channel" ) \
        | select( .package == "openshift-pipelines-operator-rh") | .name'
      Copy to Clipboard Toggle word wrap

      例5.13 出力例

      "latest"
      "pipelines-1.14"
      "pipelines-1.15"
      "pipelines-1.16"
      "pipelines-1.17"
      Copy to Clipboard Toggle word wrap
    2. 次のコマンドを実行して、チャネルで公開されているバージョンのリストを取得します。

      $ opm render <catalog_registry_url>:<tag> \
        | jq -s '.[] | select( .package == "<package_name>" ) \
        | select( .schema == "olm.channel" ) \
        | select( .name == "<channel_name>" ) | .entries \
        | .[] | .name'
      Copy to Clipboard Toggle word wrap

      例5.14 コマンドの例

      $ opm render registry.redhat.io/redhat/redhat-operator-index:v4.18 \
        | jq -s '.[] | select( .package == "openshift-pipelines-operator-rh" ) \
        | select( .schema == "olm.channel" ) | select( .name == "latest" ) \
        | .entries | .[] | .name'
      Copy to Clipboard Toggle word wrap

      例5.15 出力例

      "openshift-pipelines-operator-rh.v1.15.0"
      "openshift-pipelines-operator-rh.v1.16.0"
      "openshift-pipelines-operator-rh.v1.17.0"
      "openshift-pipelines-operator-rh.v1.17.1"
      Copy to Clipboard Toggle word wrap
  2. 次のコマンドを実行して、Operator または拡張機能の CR で指定されているバージョンまたはチャネルを確認します。

    $ oc get clusterextension <operator_name> -o yaml
    Copy to Clipboard Toggle word wrap

    コマンドの例

    $ oc get clusterextension pipelines-operator -o yaml
    Copy to Clipboard Toggle word wrap

    例5.16 出力例

    apiVersion: v1
    items:
    - apiVersion: olm.operatorframework.io/v1
      kind: ClusterExtension
      metadata:
        annotations:
          kubectl.kubernetes.io/last-applied-configuration: |
            {"apiVersion":"olm.operatorframework.io/v1","kind":"ClusterExtension","metadata":{"annotations":{},"name":"pipes"},"spec":{"namespace":"pipelines","serviceAccount":{"name":"pipelines-installer"},"source":{"catalog":{"packageName":"openshift-pipelines-operator-rh","version":"1.14.x"},"sourceType":"Catalog"}}}
        creationTimestamp: "2025-02-18T21:48:13Z"
        finalizers:
        - olm.operatorframework.io/cleanup-unpack-cache
        - olm.operatorframework.io/cleanup-contentmanager-cache
        generation: 1
        name: pipelines-operator
        resourceVersion: "72725"
        uid: e18b13fb-a96d-436f-be75-a9a0f2b07993
      spec:
        namespace: pipelines
        serviceAccount:
          name: pipelines-installer
        source:
          catalog:
            packageName: openshift-pipelines-operator-rh
            upgradeConstraintPolicy: CatalogProvided
            version: 1.14.x
          sourceType: Catalog
      status:
        conditions:
        - lastTransitionTime: "2025-02-18T21:48:13Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: Deprecated
        - lastTransitionTime: "2025-02-18T21:48:13Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: PackageDeprecated
        - lastTransitionTime: "2025-02-18T21:48:13Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: ChannelDeprecated
        - lastTransitionTime: "2025-02-18T21:48:13Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: BundleDeprecated
        - lastTransitionTime: "2025-02-18T21:48:16Z"
          message: Installed bundle registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:f7b19ce26be742c4aaa458d37bc5ad373b5b29b20aaa7d308349687d3cbd8838
            successfully
          observedGeneration: 1
          reason: Succeeded
          status: "True"
          type: Installed
        - lastTransitionTime: "2025-02-18T21:48:16Z"
          message: desired state reached
          observedGeneration: 1
          reason: Succeeded
          status: "True"
          type: Progressing
        install:
          bundle:
            name: openshift-pipelines-operator-rh.v1.14.5
            version: 1.14.5
    kind: List
    metadata:
      resourceVersion: ""
    Copy to Clipboard Toggle word wrap
  3. 次のいずれかの方法を使用して CR を編集します。

    • Operator または拡張機能を特定のバージョン (1.15.0 など) に固定する場合は、次の例のように CR を編集します。

      pipelines-operator.yaml CR の例

      apiVersion: olm.operatorframework.io/v1
      kind: ClusterExtension
      metadata:
        name: pipelines-operator
      spec:
        namespace: pipelines
        serviceAccount:
          name: pipelines-installer
        source:
          sourceType: Catalog
          catalog:
            packageName: openshift-pipelines-operator-rh
            version: "1.15.0" 
      1
      Copy to Clipboard Toggle word wrap

      1
      バージョンを 1.14.x から 1.15.0 に更新します。
    • 許容可能な更新バージョンの範囲を定義する場合は、次の例のように CR を編集します。

      バージョン範囲を指定した CR の例

      apiVersion: olm.operatorframework.io/v1
      kind: ClusterExtension
      metadata:
        name: pipelines-operator
      spec:
        namespace: pipelines
        serviceAccount:
          name: pipelines-installer
        source:
          sourceType: Catalog
          catalog:
            packageName: openshift-pipelines-operator-rh
            version: ">1.15, <1.17" 
      1
      Copy to Clipboard Toggle word wrap

      1
      必要なバージョン範囲が、バージョン 1.15 より大きく、1.17 より小さいことを指定します。詳細は、「バージョン範囲のサポート」および「バージョン比較文字列」を参照してください。
    • チャネルから解決できる最新バージョンに更新する場合は、次の例のように CR を編集します。

      チャネルを指定した CR の例

      apiVersion: olm.operatorframework.io/v1
      kind: ClusterExtension
      metadata:
        name: pipelines-operator
      spec:
        namespace: pipelines
        serviceAccount:
          name: pipelines-installer
        source:
          sourceType: Catalog
          catalog:
            packageName: openshift-pipelines-operator-rh
            channels:
              - latest 
      1
      Copy to Clipboard Toggle word wrap

      1
      指定されたチャネルから解決できる最新リリースをインストールします。チャネルへの更新は自動的にインストールされます。値を配列として入力します。
    • チャネルとバージョンまたはバージョン範囲を指定する場合は、次の例のように CR を編集します。

      チャネルとバージョン範囲を指定した CR の例

      apiVersion: olm.operatorframework.io/v1
      kind: ClusterExtension
      metadata:
        name: pipelines-operator
      spec:
        namespace: pipelines
        serviceAccount:
          name: pipelines-installer
        source:
          sourceType: Catalog
          catalog:
            packageName: openshift-pipelines-operator-rh
            channels:
              - latest
            version: "<1.16"
      Copy to Clipboard Toggle word wrap

      詳細は、「ターゲットバージョンを指定するカスタムリソース (CR) の例」を参照してください。

  4. 次のコマンドを実行して、クラスターに更新を適用します。

    $ oc apply -f pipelines-operator.yaml
    Copy to Clipboard Toggle word wrap

    出力例

    clusterextension.olm.operatorframework.io/pipelines-operator configured
    Copy to Clipboard Toggle word wrap

検証

  • 次のコマンドを実行して、チャネルとバージョンの更新が適用されていることを確認します。

    $ oc get clusterextension pipelines-operator -o yaml
    Copy to Clipboard Toggle word wrap

    例5.17 出力例

    apiVersion: olm.operatorframework.io/v1
    kind: ClusterExtension
    metadata:
      annotations:
        kubectl.kubernetes.io/last-applied-configuration: |
          {"apiVersion":"olm.operatorframework.io/v1","kind":"ClusterExtension","metadata":{"annotations":{},"name":"pipes"},"spec":{"namespace":"pipelines","serviceAccount":{"name":"pipelines-installer"},"source":{"catalog":{"packageName":"openshift-pipelines-operator-rh","version":"\u003c1.16"},"sourceType":"Catalog"}}}
      creationTimestamp: "2025-02-18T21:48:13Z"
      finalizers:
      - olm.operatorframework.io/cleanup-unpack-cache
      - olm.operatorframework.io/cleanup-contentmanager-cache
      generation: 2
      name: pipes
      resourceVersion: "90693"
      uid: e18b13fb-a96d-436f-be75-a9a0f2b07993
    spec:
      namespace: pipelines
      serviceAccount:
        name: pipelines-installer
      source:
        catalog:
          packageName: openshift-pipelines-operator-rh
          upgradeConstraintPolicy: CatalogProvided
          version: <1.16
        sourceType: Catalog
    status:
      conditions:
      - lastTransitionTime: "2025-02-18T21:48:13Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: Deprecated
      - lastTransitionTime: "2025-02-18T21:48:13Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: PackageDeprecated
      - lastTransitionTime: "2025-02-18T21:48:13Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: ChannelDeprecated
      - lastTransitionTime: "2025-02-18T21:48:13Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: BundleDeprecated
      - lastTransitionTime: "2025-02-18T21:48:16Z"
        message: Installed bundle registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:8a593c1144709c9aeffbeb68d0b4b08368f528e7bb6f595884b2474bcfbcafcd
          successfully
        observedGeneration: 2
        reason: Succeeded
        status: "True"
        type: Installed
      - lastTransitionTime: "2025-02-18T21:48:16Z"
        message: desired state reached
        observedGeneration: 2
        reason: Succeeded
        status: "True"
        type: Progressing
      install:
        bundle:
          name: openshift-pipelines-operator-rh.v1.15.2
          version: 1.15.2
    Copy to Clipboard Toggle word wrap

トラブルシューティング

  • 非推奨または存在しないターゲットバージョンまたはチャネルを指定する場合は、次のコマンドを実行して拡張機能のステータスを確認できます。

    $ oc get clusterextension <operator_name> -o yaml
    Copy to Clipboard Toggle word wrap

    例5.18 存在しないバージョンの出力例

    apiVersion: olm.operatorframework.io/v1
    kind: ClusterExtension
    metadata:
      annotations:
        kubectl.kubernetes.io/last-applied-configuration: |
          {"apiVersion":"olm.operatorframework.io/v1","kind":"ClusterExtension","metadata":{"annotations":{},"name":"pipes"},"spec":{"namespace":"pipelines","serviceAccount":{"name":"pipelines-installer"},"source":{"catalog":{"packageName":"openshift-pipelines-operator-rh","version":"9.x"},"sourceType":"Catalog"}}}
      creationTimestamp: "2025-02-18T21:48:13Z"
      finalizers:
      - olm.operatorframework.io/cleanup-unpack-cache
      - olm.operatorframework.io/cleanup-contentmanager-cache
      generation: 3
      name: pipes
      resourceVersion: "93334"
      uid: e18b13fb-a96d-436f-be75-a9a0f2b07993
    spec:
      namespace: pipelines
      serviceAccount:
        name: pipelines-installer
      source:
        catalog:
          packageName: openshift-pipelines-operator-rh
          upgradeConstraintPolicy: CatalogProvided
          version: 9.x
        sourceType: Catalog
    status:
      conditions:
      - lastTransitionTime: "2025-02-18T21:48:13Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: Deprecated
      - lastTransitionTime: "2025-02-18T21:48:13Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: PackageDeprecated
      - lastTransitionTime: "2025-02-18T21:48:13Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: ChannelDeprecated
      - lastTransitionTime: "2025-02-18T21:48:13Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: BundleDeprecated
      - lastTransitionTime: "2025-02-18T21:48:16Z"
        message: Installed bundle registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:8a593c1144709c9aeffbeb68d0b4b08368f528e7bb6f595884b2474bcfbcafcd
          successfully
        observedGeneration: 3
        reason: Succeeded
        status: "True"
        type: Installed
      - lastTransitionTime: "2025-02-18T21:48:16Z"
        message: 'error upgrading from currently installed version "1.15.2": no bundles
          found for package "openshift-pipelines-operator-rh" matching version "9.x"'
        observedGeneration: 3
        reason: Retrying
        status: "True"
        type: Progressing
      install:
        bundle:
          name: openshift-pipelines-operator-rh.v1.15.2
          version: 1.15.2
    Copy to Clipboard Toggle word wrap

5.1.6. Operator の削除

ClusterExtension カスタムリソース (CR) を削除することで、Operator とそのカスタムリソース定義 (CRD) を削除できます。

前提条件

  • カタログがインストールされています。
  • Operator がインストールされています。

手順

  • 次のコマンドを実行して、Operator とその CRD を削除します。

    $ oc delete clusterextension <operator_name>
    Copy to Clipboard Toggle word wrap

    出力例

    clusterextension.olm.operatorframework.io "<operator_name>" deleted
    Copy to Clipboard Toggle word wrap

検証

  • 次のコマンドを実行して、Operator とそのリソースが削除されたことを確認します。

    • 次のコマンドを実行して、Operator が削除されたことを確認します。

      $ oc get clusterextensions
      Copy to Clipboard Toggle word wrap

      出力例

      No resources found
      Copy to Clipboard Toggle word wrap

    • 次のコマンドを実行して、Operator のシステム namespace が削除されたことを確認します。

      $ oc get ns <operator_name>-system
      Copy to Clipboard Toggle word wrap

      出力例

      Error from server (NotFound): namespaces "<operator_name>-system" not found
      Copy to Clipboard Toggle word wrap

トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat