mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-06 06:46:26 +01:00
126 lines
3.0 KiB
Plaintext
126 lines
3.0 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * operators/admin/olm-managing-custom-catalogs.adoc
|
|
|
|
[id="olm-testing-operator-catalog-image_{context}"]
|
|
= Testing a Package Manifeste Format catalog image
|
|
|
|
You can validate Operator catalog image content by running it as a container and
|
|
querying its gRPC API. To further test the image, you can then resolve a
|
|
Subscription in Operator Lifecycle Manager (OLM) by referencing the image in a
|
|
CatalogSource. For this example, the procedure uses a custom `redhat-operators`
|
|
catalog image previously built and pushed to a supported registry.
|
|
|
|
.Prerequisites
|
|
|
|
* A custom Package Manifest Format catalog image pushed to a supported registry
|
|
* `podman` version 1.4.4+
|
|
* `oc` version 4.3.5+
|
|
* Access to mirror registry that supports
|
|
link:https://docs.docker.com/registry/spec/manifest-v2-2/[Docker v2-2]
|
|
* link:https://github.com/fullstorydev/grpcurl[`grpcurl`]
|
|
|
|
.Procedure
|
|
|
|
. Pull the Operator catalog image:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ podman pull <registry_host_name>:<port>/olm/redhat-operators:v1
|
|
----
|
|
|
|
. Run the image:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ podman run -p 50051:50051 \
|
|
-it <registry_host_name>:<port>/olm/redhat-operators:v1
|
|
----
|
|
|
|
. Query the running image for available packages using `grpcurl`:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ grpcurl -plaintext localhost:50051 api.Registry/ListPackages
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
{
|
|
"name": "3scale-operator"
|
|
}
|
|
{
|
|
"name": "amq-broker"
|
|
}
|
|
{
|
|
"name": "amq-online"
|
|
}
|
|
----
|
|
|
|
. Get the latest Operator bundle in a channel:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ grpcurl -plaintext -d '{"pkgName":"kiali-ossm","channelName":"stable"}' localhost:50051 api.Registry/GetBundleForChannel
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
{
|
|
"csvName": "kiali-operator.v1.0.7",
|
|
"packageName": "kiali-ossm",
|
|
"channelName": "stable",
|
|
...
|
|
----
|
|
|
|
. Get the digest of the image:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ podman inspect \
|
|
--format='{{index .RepoDigests 0}}' \
|
|
<registry_host_name>:<port>/olm/redhat-operators:v1
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
example_registry:5000/olm/redhat-operators@sha256:f73d42950021f9240389f99ddc5b0c7f1b533c054ba344654ff1edaf6bf827e3
|
|
----
|
|
|
|
. Assuming an OperatorGroup exists in namespace `my-ns` that supports your
|
|
Operator and its dependencies, create a CatalogSource object using the image
|
|
digest. For example:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: operators.coreos.com/v1alpha1
|
|
kind: CatalogSource
|
|
metadata:
|
|
name: custom-redhat-operators
|
|
namespace: my-ns
|
|
spec:
|
|
sourceType: grpc
|
|
image: example_registry:5000/olm/redhat-operators@sha256:f73d42950021f9240389f99ddc5b0c7f1b533c054ba344654ff1edaf6bf827e3
|
|
displayName: Red Hat Operators
|
|
----
|
|
|
|
. Create a Subscription that resolves the latest available `servicemeshoperator`
|
|
and its dependencies from your catalog image:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: operators.coreos.com/v1alpha1
|
|
kind: Subscription
|
|
metadata:
|
|
name: servicemeshoperator
|
|
namespace: my-ns
|
|
spec:
|
|
source: custom-redhat-operators
|
|
sourceNamespace: my-ns
|
|
name: servicemeshoperator
|
|
channel: "1.0"
|
|
----
|