Deploying onto OpenShift
This section is to help you verify that the operator deploys successfully from the metadata bundle onto OpenShift using the Operator Lifecycle Manager (OLM).
Before getting started
Install the operator package manager (OPM) tool
Creating an index image
You can create an index image using the opm
CLI.
Start a new index:
Push the index image to a registry:
Be sure to make your quay.io repositories for the bundle image and the index image public. You can can change this in the settings in quay.io
Create the CatalogSource
In your OpenShift environment create a catalog source in the openshift-marketplace namespace.
2. You can verify the catalogsource has been created by running the following command:
You should see the following output:
3. Once you have confirmed the catalogsource exists, run the following command to verify it's associated pod is successfully running. This verifies that the index image has been successfully pulled down from the repository.
You should see the following output:
4. Verify that the operator package has been successfully added:
Create OperatorGroup
Create a namespace for your project
2. Create the OperatorGroup
3. Verify you have a working operatorgroup within the namespace you created:
You should see the following output:
Create a Subscription
Verify the subscription is created within your namespace:
You should see the following output:
The creation of the subscription should trigger the creation of the InstallPlan and CSV.
You should see something similar to this output:
Verify your operator is running in the namespace:
Updating an existing index image
You can update an existing index image with a new operator bundle version using the opm
CLI.
Update the existing index:
Push the updated index image:
After OLM polls the index image at its specified interval, we should eventually see a new installplan for our new operator bundle version
Run the Scorecard test
The Operator Scorecard is a testing utility included in the operator-sdk
binary that guides users towards operator best practices by checking the correctness of their operators and CSVs. With your operator deployed via OLM, you can run the operator-sdk scorecard
utility to create a CR which will trigger the operator and monitor what occurs.
In order to certify you must pass the first two Basic Tests: Spec Block Exists, and Status Block Exists. Passing the third basic test (Writing into CRs has an effect) requires adding the scorecard-proxy container to the operator deployment, which is not desired in a production operator and is therefore not required for certification.
In order to run scorecard locally against your operator deployed via OLM please refer to this section of the upstream documentation
Last updated