5.2. Managing cluster extensions
You use catalogs to access the versions, patches, and over-the-air updates for extensions and Operators. You use custom resources (CRs) to manage extensions declaratively from the CLI.
For OpenShift Container Platform 4.21, documented procedures for OLM v1 are CLI-based only. Alternatively, administrators can create and view related objects in the web console by using normal methods, such as the Import YAML and Search pages. However, the existing Software Catalog and Installed Operators pages do not yet display OLM v1 components.
5.2.1. Finding Operators to install from a catalog 复制链接链接已复制到粘贴板!
After you add a catalog to your cluster, you can query the catalog to find Operators and extensions to install.
Currently in Operator Lifecycle Manager (OLM) v1, you cannot query on-cluster catalogs managed by catalogd. In OLM v1, you must use the opm and jq CLI tools to query the catalog registry.
Prerequisites
- You have added a catalog to your cluster.
-
You have installed the
jqCLI tool. -
You have installed the
opmCLI tool.
Procedure
To return a list of extensions that support the
AllNamespacesinstall mode and do not use webhooks, enter the following command:$ 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[]'where:
catalog_registry_url-
Specifies the URL of the catalog registry, such as
registry.redhat.io/redhat/redhat-operator-index. tagSpecifies the tag or version of the catalog, such as
v4.21orlatest.例 5.1. Example command
$ opm render \ registry.redhat.io/redhat/redhat-operator-index:v4.21 \ | 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. Example output
"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" ...
Inspect the contents of an extension’s metadata by running the following command:
$ opm render <catalog_registry_url>:<tag> \ | jq -s '.[] | select( .schema == "olm.package") \ | select( .name == "<package_name>")'例 5.3. Example command
$ opm render \ registry.redhat.io/redhat/redhat-operator-index:v4.21 \ | jq -s '.[] | select( .schema == "olm.package") \ | select( .name == "openshift-pipelines-operator-rh")'例 5.4. Example output
{ "schema": "olm.package", "name": "openshift-pipelines-operator-rh", "defaultChannel": "latest", "icon": { "base64data": "iVBORw0KGgoAAAANSUhE...", "mediatype": "image/png" } }
5.2.1.1. Common catalog queries 复制链接链接已复制到粘贴板!
You can query catalogs by using the opm and jq CLI tools. The following tables show common catalog queries that you can use when installing, updating, and managing the lifecycle of extensions.
Command syntax
$ opm render <catalog_registry_url>:<tag> | <jq_request>
where:
catalog_registry_url-
Specifies the URL of the catalog registry, such as
registry.redhat.io/redhat/redhat-operator-index. tag-
Specifies the tag or version of the catalog, such as
v4.21orlatest. jq_request- Specifies the query you want to run on the catalog.
例 5.5. Example command
$ opm render \
registry.redhat.io/redhat/redhat-operator-index:v4.21 \
| 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[]'
| Query | Request |
|---|---|
| Available packages in a catalog |
|
|
Packages that support |
|
| Package metadata |
|
| Catalog blobs in a package |
|
| Query | Request |
|---|---|
| Channels in a package |
|
| Versions in a channel |
|
|
|
| Query | Request |
|---|---|
| Bundles in a package |
|
|
|