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


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

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

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

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

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

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

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

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

重要

Operator Lifecycle Manager (OLM) v1 は、既存の OLM で導入された 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[]'

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

    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[]'

    例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"
    ...
  2. 次のコマンドを実行して、拡張機能のメタデータの内容を検査します。

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

    例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")'

    例5.4 出力例

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

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

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

コマンド構文

$ opm render <catalog_registry_url>:<tag> | <jq_request>

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

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[]'
表5.1 一般的なパッケージクエリー
クエリーRequest

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

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

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[]'

パッケージのメタデータ

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

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

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

パッケージのチャネル

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

チャネル内のバージョン

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

パッケージ内のバンドル

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

5.1.3. クラスター拡張機能の管理に使用するサービスアカウントの作成

既存の Operator Lifecycle Manager (OLM) とは異なり、OLM v1 にはクラスター拡張機能をインストール、更新、および管理する権限がありません。クラスター管理者は、サービスアカウントを作成し、クラスター拡張機能のインストール、更新、管理に必要なロールベースのアクセス制御 (RBAC) を割り当てる必要があります。

重要

OLM v1 には既知の問題があります。拡張機能のサービスアカウントに適切なロールベースのアクセス制御 (RBAC) を割り当てなければ、OLM v1 が停止し、調整が停止します。

現在、OLM v1 には、拡張機能管理者がサービスアカウントの適切な RBAC を見つけるために使用できるツールはありません。

OLM v1 はテクノロジープレビュー機能であり、実稼働クラスターでは使用できないため、この問題を回避するためには、ドキュメントに含まれているより許容度の高い RBAC を使用します。

この RBAC はテスト目的に限定して使用できます。実稼働クラスターでは使用しないでください。

前提条件

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

手順

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

    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: <extension>-installer
      namespace: <namespace>

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

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

    $ oc apply -f extension-service-account.yaml
  3. 次の例のように、クラスターロールを作成し、RBAC を割り当てます。

    警告

    次のクラスターロールは、最小権限の原則に従っていません。このクラスターロールはテスト目的に限定して使用できます。実稼働クラスターでは使用しないでください。

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

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

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      name: pipelines-installer-clusterrole
    rules:
    - apiGroups: ["*"]
      resources: ["*"]
      verbs: ["*"]
  4. 次のコマンドを実行して、クラスターにクラスターロールを追加します。

    $ oc apply -f pipelines-role.yaml
  5. 次の例のように、クラスターロールバインディングを作成して、クラスターロールによって付与された権限をサービスアカウントにバインドします。

    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>

    例5.8 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
  6. 次のコマンドを実行して、クラスターロールバインディングを適用します。

    $ oc apply -f pipelines-cluster-role-binding.yaml

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

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

前提条件

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

手順

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

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

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

      例5.9 コマンドの例

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

      例5.10 出力例

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

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

      例5.11 コマンドの例

      $ 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'

      例5.12 出力例

      "openshift-pipelines-operator-rh.v1.14.3"
      "openshift-pipelines-operator-rh.v1.14.4"
      "openshift-pipelines-operator-rh.v1.14.5"
      "openshift-pipelines-operator-rh.v1.15.0"
      "openshift-pipelines-operator-rh.v1.15.1"
      "openshift-pipelines-operator-rh.v1.15.2"
      "openshift-pipelines-operator-rh.v1.16.0"
      "openshift-pipelines-operator-rh.v1.16.1"
  2. 拡張機能を新しい namespace にインストールする場合は、次のコマンドを実行します。

    $ oc adm new-project <new_namespace>
  3. 次の例のような CR を作成します。

    pipelines-operator.yaml CR の例

    apiVersion: olm.operatorframework.io/v1alpha1
    kind: ClusterExtension
    metadata:
      name: pipelines-operator
    spec:
      packageName: openshift-pipelines-operator-rh
      installNamespace: <namespace>
      serviceAccount:
        name: <service_account>
      channel: <channel>
      version: "<version>"

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

    <namespace>
    pipelinesmy-extension など、バンドルをインストールする namespace を指定します。拡張機能は継続してクラスタースコープであり、異なる namespace にインストールされているリソースが含まれる可能性があります。
    <service_account>
    拡張機能をインストール、更新、管理するために作成したサービスアカウントの名前を指定します。
    <channel>
    オプション: インストールまたは更新するパッケージのチャネル (pipelines-1.11latest など) を指定します。
    <version>

    オプション: インストールまたは更新するパッケージのバージョンまたはバージョン範囲 (1.11.11.12.x>=1.12.1 など) を指定します。詳細は、「ターゲットバージョンを指定するカスタムリソース (CR) の例」および「バージョン範囲のサポート」を参照してください。

    重要

    一意の名前を持たない Operator または拡張機能をインストールしようとすると、インストールが失敗するか、予期しない結果になる可能性があります。その原因は以下のとおりです。

    • クラスターに複数のカタログがインストールされている場合、Operator Lifecycle Manager (OLM) v1 には、Operator または拡張機能のインストール時にカタログを指定するメカニズムがありません。
    • OLM v1 では、クラスターにインストールできるすべての Operator および拡張機能のバンドルとパッケージに、一意の名前が使用されている必要があります。
  4. 次のコマンドを実行して、CR をクラスターに適用します。

    $ oc apply -f pipeline-operator.yaml

    出力例

    clusterextension.olm.operatorframework.io/pipelines-operator created

検証

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

    $ oc get clusterextension pipelines-operator -o yaml

    例5.13 出力例

    apiVersion: v1
    items:
    - apiVersion: olm.operatorframework.io/v1alpha1
      kind: ClusterExtension
      metadata:
        annotations:
          kubectl.kubernetes.io/last-applied-configuration: |
            {"apiVersion":"olm.operatorframework.io/v1alpha1","kind":"ClusterExtension","metadata":{"annotations":{},"name":"pipelines-operator"},"spec":{"channel":"latest","installNamespace":"pipelines","packageName":"openshift-pipelines-operator-rh","serviceAccount":{"name":"pipelines-installer"},"pollInterval":"30m"}}
        creationTimestamp: "2024-06-10T17:50:51Z"
        finalizers:
        - olm.operatorframework.io/cleanup-unpack-cache
        generation: 1
        name: pipelines-operator
        resourceVersion: "53324"
        uid: c54237be-cde4-46d4-9b31-d0ec6acc19bf
      spec:
        channel: latest
        installNamespace: pipelines
        packageName: openshift-pipelines-operator-rh
        serviceAccount:
          name: pipelines-installer
        upgradeConstraintPolicy: Enforce
      status:
        conditions:
        - lastTransitionTime: "2024-06-10T17:50:58Z"
          message: resolved to "registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:dd3d18367da2be42539e5dde8e484dac3df33ba3ce1d5bcf896838954f3864ec"
          observedGeneration: 1
          reason: Success
          status: "True"
          type: Resolved
        - lastTransitionTime: "2024-06-10T17:51:11Z"
          message: installed from "registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:dd3d18367da2be42539e5dde8e484dac3df33ba3ce1d5bcf896838954f3864ec"
          observedGeneration: 1
          reason: Success
          status: "True"
          type: Installed
        - lastTransitionTime: "2024-06-10T17:50:58Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: Deprecated
        - lastTransitionTime: "2024-06-10T17:50:58Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: PackageDeprecated
        - lastTransitionTime: "2024-06-10T17:50:58Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: ChannelDeprecated
        - lastTransitionTime: "2024-06-10T17:50:58Z"
          message: ""
          observedGeneration: 1
          reason: Deprecated
          status: "False"
          type: BundleDeprecated
        - lastTransitionTime: "2024-06-10T17:50:58Z"
          message: 'unpack successful:
          observedGeneration: 1
          reason: UnpackSuccess
          status: "True"
          type: Unpacked
        installedBundle:
          name: openshift-pipelines-operator-rh.v1.14.4
          version: 1.14.4
        resolvedBundle:
          name: openshift-pipelines-operator-rh.v1.14.4
          version: 1.14.4

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

    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
    インストールされているバンドルのバージョンを表示します。
    resolvedBundle.name
    解決されたバンドルの名前を表示します。
    resolvedBundle.version
    解決されたバンドルのバージョンを表示します。

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

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

前提条件

  • カタログがインストールされています。
  • カタログファイルのローカルコピーをダウンロードしている。
  • Operator または拡張機能がインストールされている。
  • jq CLI ツールがインストールされている。

手順

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

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

      $ jq -s '.[] | select( .schema == "olm.channel" ) | \
        select( .package == "<package_name>") | \
        .name' /<path>/<catalog_name>.json

      例5.14 コマンドの例

      $ jq -s '.[] | select( .schema == "olm.channel" ) | \
        select( .package == "openshift-pipelines-operator-rh") | \
        .name' /home/username/rhoc.json

      例5.15 出力例

      "latest"
      "pipelines-1.11"
      "pipelines-1.12"
      "pipelines-1.13"
      "pipelines-1.14"
    2. 次のコマンドを実行して、チャネルで公開されているバージョンのリストを取得します。

      $ jq -s '.[] | select( .package == "<package_name>" ) | \
        select( .schema == "olm.channel" ) | \
        select( .name == "<channel_name>" ) | .entries | \
        .[] | .name' /<path>/<catalog_name>.json

      例5.16 コマンドの例

      $ jq -s '.[] | select( .package == "openshift-pipelines-operator-rh" ) | \
      select( .schema == "olm.channel" ) | select( .name == "latest" ) | \
      .entries | .[] | .name' /home/username/rhoc.json

      例5.17 出力例

      "openshift-pipelines-operator-rh.v1.11.1"
      "openshift-pipelines-operator-rh.v1.12.0"
      "openshift-pipelines-operator-rh.v1.12.1"
      "openshift-pipelines-operator-rh.v1.12.2"
      "openshift-pipelines-operator-rh.v1.13.0"
      "openshift-pipelines-operator-rh.v1.14.1"
      "openshift-pipelines-operator-rh.v1.14.2"
      "openshift-pipelines-operator-rh.v1.14.3"
      "openshift-pipelines-operator-rh.v1.14.4"
  2. 次のコマンドを実行して、Operator または拡張機能の CR で指定されているバージョンまたはチャネルを確認します。

    $ oc get clusterextension <operator_name> -o yaml

    コマンドの例

    $ oc get clusterextension pipelines-operator -o yaml

    例5.18 出力例

    apiVersion: olm.operatorframework.io/v1alpha1
    kind: ClusterExtension
    metadata:
      annotations:
        kubectl.kubernetes.io/last-applied-configuration: |
          {"apiVersion":"olm.operatorframework.io/v1alpha1","kind":"ClusterExtension","metadata":{"annotations":{},"name":"pipelines-operator"},"spec":{"channel":"latest","installNamespace":"openshift-operators","packageName":"openshift-pipelines-operator-rh","pollInterval":"30m","version":"\u003c1.12"}}
      creationTimestamp: "2024-06-11T15:55:37Z"
      generation: 1
      name: pipelines-operator
      resourceVersion: "69776"
      uid: 6a11dff3-bfa3-42b8-9e5f-d8babbd6486f
    spec:
      channel: latest
      installNamespace: openshift-operators
      packageName: openshift-pipelines-operator-rh
      upgradeConstraintPolicy: Enforce
      version: <1.12
    status:
      conditions:
      - lastTransitionTime: "2024-06-11T15:56:09Z"
        message: installed from "registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:e09d37bb1e754db42324fd18c1cb3e7ce77e7b7fcbf4932d0535391579938280"
        observedGeneration: 1
        reason: Success
        status: "True"
        type: Installed
      - lastTransitionTime: "2024-06-11T15:55:50Z"
        message: resolved to "registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:e09d37bb1e754db42324fd18c1cb3e7ce77e7b7fcbf4932d0535391579938280"
        observedGeneration: 1
        reason: Success
        status: "True"
        type: Resolved
      - lastTransitionTime: "2024-06-11T15:55:50Z"
        message: ""
        observedGeneration: 1
        reason: Deprecated
        status: "False"
        type: Deprecated
      - lastTransitionTime: "2024-06-11T15:55:50Z"
        message: ""
        observedGeneration: 1
        reason: Deprecated
        status: "False"
        type: PackageDeprecated
      - lastTransitionTime: "2024-06-11T15:55:50Z"
        message: ""
        observedGeneration: 1
        reason: Deprecated
        status: "False"
        type: ChannelDeprecated
      - lastTransitionTime: "2024-06-11T15:55:50Z"
        message: ""
        observedGeneration: 1
        reason: Deprecated
        status: "False"
        type: BundleDeprecated
      installedBundle:
        name: openshift-pipelines-operator-rh.v1.11.1
        version: 1.11.1
      resolvedBundle:
        name: openshift-pipelines-operator-rh.v1.11.1
        version: 1.11.1
  3. 次のいずれかの方法を使用して CR を編集します。

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

      pipelines-operator.yaml CR の例

      apiVersion: olm.operatorframework.io/v1alpha1
      kind: ClusterExtension
      metadata:
        name: pipelines-operator
      spec:
        packageName: openshift-pipelines-operator-rh
        installNamespace: <namespace>
        version: "1.12.1" 1

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

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

      apiVersion: olm.operatorframework.io/v1alpha1
      kind: ClusterExtension
      metadata:
        name: pipelines-operator
      spec:
        packageName: openshift-pipelines-operator-rh
        installNamespace: <namespace>
        version: ">1.11.1, <1.13" 1

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

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

      apiVersion: olm.operatorframework.io/v1alpha1
      kind: ClusterExtension
      metadata:
        name: pipelines-operator
      spec:
        packageName: openshift-pipelines-operator-rh
        installNamespace: <namespace>
        channel: pipelines-1.13 1

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

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

      apiVersion: olm.operatorframework.io/v1alpha1
      kind: ClusterExtension
      metadata:
        name: pipelines-operator
      spec:
        packageName: openshift-pipelines-operator-rh
        installNamespace: <namespace>
        channel: latest
        version: "<1.13"

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

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

    $ oc apply -f pipelines-operator.yaml

    出力例

    clusterextension.olm.operatorframework.io/pipelines-operator configured

    ヒント

    次のコマンドを実行すると、CLI から CR にパッチを適用して変更を適用できます。

    $ oc patch clusterextension/pipelines-operator -p \
      '{"spec":{"version":"<1.13"}}' \
      --type=merge

    出力例

    clusterextension.olm.operatorframework.io/pipelines-operator patched

検証

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

    $ oc get clusterextension pipelines-operator -o yaml

    例5.19 出力例

    apiVersion: olm.operatorframework.io/v1alpha1
    kind: ClusterExtension
    metadata:
      annotations:
        kubectl.kubernetes.io/last-applied-configuration: |
          {"apiVersion":"olm.operatorframework.io/v1alpha1","kind":"ClusterExtension","metadata":{"annotations":{},"name":"pipelines-operator"},"spec":{"channel":"latest","installNamespace":"openshift-operators","packageName":"openshift-pipelines-operator-rh","pollInterval":"30m","version":"\u003c1.13"}}
      creationTimestamp: "2024-06-11T18:23:26Z"
      generation: 2
      name: pipelines-operator
      resourceVersion: "66310"
      uid: ce0416ba-13ea-4069-a6c8-e5efcbc47537
    spec:
      channel: latest
      installNamespace: openshift-operators
      packageName: openshift-pipelines-operator-rh
      upgradeConstraintPolicy: Enforce
      version: <1.13
    status:
      conditions:
      - lastTransitionTime: "2024-06-11T18:23:33Z"
        message: resolved to "registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:814742c8a7cc7e2662598e114c35c13993a7b423cfe92548124e43ea5d469f82"
        observedGeneration: 2
        reason: Success
        status: "True"
        type: Resolved
      - lastTransitionTime: "2024-06-11T18:23:52Z"
        message: installed from "registry.redhat.io/openshift-pipelines/pipelines-operator-bundle@sha256:814742c8a7cc7e2662598e114c35c13993a7b423cfe92548124e43ea5d469f82"
        observedGeneration: 2
        reason: Success
        status: "True"
        type: Installed
      - lastTransitionTime: "2024-06-11T18:23:33Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: Deprecated
      - lastTransitionTime: "2024-06-11T18:23:33Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: PackageDeprecated
      - lastTransitionTime: "2024-06-11T18:23:33Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: ChannelDeprecated
      - lastTransitionTime: "2024-06-11T18:23:33Z"
        message: ""
        observedGeneration: 2
        reason: Deprecated
        status: "False"
        type: BundleDeprecated
      installedBundle:
        name: openshift-pipelines-operator-rh.v1.12.2
        version: 1.12.2
      resolvedBundle:
        name: openshift-pipelines-operator-rh.v1.12.2
        version: 1.12.2

トラブルシューティング

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

    $ oc get clusterextension <operator_name> -o yaml

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

    apiVersion: olm.operatorframework.io/v1alpha1
    kind: ClusterExtension
    metadata:
      annotations:
        kubectl.kubernetes.io/last-applied-configuration: |
          {"apiVersion":"olm.operatorframework.io/v1alpha1","kind":"ClusterExtension","metadata":{"annotations":{},"name":"pipelines-operator"},"spec":{"channel":"latest","installNamespace":"openshift-operators","packageName":"openshift-pipelines-operator-rh","pollInterval":"30m","version":"3.0"}}
      creationTimestamp: "2024-06-11T18:23:26Z"
      generation: 3
      name: pipelines-operator
      resourceVersion: "71852"
      uid: ce0416ba-13ea-4069-a6c8-e5efcbc47537
    spec:
      channel: latest
      installNamespace: openshift-operators
      packageName: openshift-pipelines-operator-rh
      upgradeConstraintPolicy: Enforce
      version: "3.0"
    status:
      conditions:
      - lastTransitionTime: "2024-06-11T18:29:02Z"
        message: 'error upgrading from currently installed version "1.12.2": no package
          "openshift-pipelines-operator-rh" matching version "3.0" found in channel "latest"'
        observedGeneration: 3
        reason: ResolutionFailed
        status: "False"
        type: Resolved
      - lastTransitionTime: "2024-06-11T18:29:02Z"
        message: installation has not been attempted as resolution failed
        observedGeneration: 3
        reason: InstallationStatusUnknown
        status: Unknown
        type: Installed
      - lastTransitionTime: "2024-06-11T18:29:02Z"
        message: deprecation checks have not been attempted as resolution failed
        observedGeneration: 3
        reason: Deprecated
        status: Unknown
        type: Deprecated
      - lastTransitionTime: "2024-06-11T18:29:02Z"
        message: deprecation checks have not been attempted as resolution failed
        observedGeneration: 3
        reason: Deprecated
        status: Unknown
        type: PackageDeprecated
      - lastTransitionTime: "2024-06-11T18:29:02Z"
        message: deprecation checks have not been attempted as resolution failed
        observedGeneration: 3
        reason: Deprecated
        status: Unknown
        type: ChannelDeprecated
      - lastTransitionTime: "2024-06-11T18:29:02Z"
        message: deprecation checks have not been attempted as resolution failed
        observedGeneration: 3
        reason: Deprecated
        status: Unknown
        type: BundleDeprecated

関連情報

5.1.6. Operator の削除

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

前提条件

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

手順

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

    $ oc delete clusterextension <operator_name>

    出力例

    clusterextension.olm.operatorframework.io "<operator_name>" deleted

検証

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

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

      $ oc get clusterextensions

      出力例

      No resources found

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

      $ oc get ns <operator_name>-system

      出力例

      Error from server (NotFound): namespaces "<operator_name>-system" not found

Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

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

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

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

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

会社概要

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

© 2024 Red Hat, Inc.