In the current state of 4.3, creating a catalogsource will create an operator registry pod using the
old format. The new format is available through the use of the opm
binary / command line utility that is not
currently referenced when building an operator registry pod on an OCP cluster. Hence, we cannot test the new
fields and formats that were added to the registry database on an OCP cluster. In order to test that the operator
registry has been populated with the correct content, we need to do this testing locally.
Operator-Registry communicates usinng grpc. To test that the content is properly set we need to create a new
operator registry service by using the opm
command line tool locally and query the registry server using grpcurl.
Note: requires golang v1.12 or greater
git clone https://github.com/operator-framework/operator-registry
cd operator-registry
export GO111MODULE=on
go build -mod=vendor -o bin/opm ./cmd/opm
This requires a given set of operator manifests for a specific version. For example:
bundles/prometheus.0.14.0/manifests
├── alertmanager.crd.yaml
├── prometheus.crd.yaml
├── prometheusoperator.0.14.0.clusterserviceversion.yaml
├── prometheusrule.crd.yaml
└── servicemonitor.crd.yaml
With the above set of manifests for prometheus version 0.14.0 we can build a bundle image.
./bin/opm alpha bundle build --directory bundles/prometheus.0.14.0/manifests --tag quay.io/${USERNAME}/prometheus-test:0.14.0 --package prometheus --channels preview --default preview
You can repeat this process with version 0.15.0 or other operators. Finally, push these to a container registry.
Note: bundles.db
can be an existing db file. If there the file cannot be found the command will create one.
./bin/opm registry add -d=bundles.db -b="quay.io/${USERNAME}/etcd-test:0.9.0,quay.io/${USERNAME}/prometheus-test:0.14.0,quay.io/${USERNAME}/prometheus-test:0.15.0,quay.io/${USERNAME}/prometheus-test:0.22.0"
./bin/opm registry serve -t=log.log -d=bundles.db
You can use grpcurl to query the content in the database exposed by the serve
command above. For example to query
bundle information for a specific operator:
grpcurl -plaintext -d '{"pkgName":"prometheus","channelName":"preview","csvName":"prometheusoperator.0.14.0"}' localhost:50051 api.Registry/GetBundle
This will return the bundle or bundlePath.
./bin/opm index add -b "quay.io/${USERNAME}/prometheus-test:0.14.0" -t "quay.io/${USERNAME}/testing-index:0.0.1"
./bin/opm index add -b "quay.io/${USERNAME}/prometheus-test:0.15.0,quay.io/${USERNAME}/prometheus-test:0.22.0" --from-index="quay.io/${USERNAME}/testing-index:0.0.1" -t "quay.io/${USERNAME}/testing-index:0.0.2"
The container serves the database so you will be able to repeat the above steps by interacting with the index container.