Operators framework is the new way to manage complex applications on top of Kubernetes. They embed operational knowledge about applications and manage all the lifecycle from installation, upgrade, monitoring, and even autopilot according to a capability model.

OpenShift 4 is making use of operators, and it offers a way to install operators from a hub called OperatorHub in the web console:

Today, we are going to build a customized operator registry to handle pre-existing operators, configure OpenShift to show these operators, and allow them to install them from the web console catalog.


To accomplish this lab, you will need: OpenShift 4.5+ cluster, operator-sdk, oc CLI, and a Docker v2_2 schema registry (in our case, we will be using 

Some commands evolve regarding the CLI versions; please keep in mind to use the following versions, or to update the commands:

$ operator-sdk version operator-sdk version: "v0.18.2", commit: "f059b5e17447b0bbcef50846859519340c17ffad", kubernetes version: "v1.18.2", go version: "go1.14.4 darwin/amd64"
$ oc get clusterversion NAME      VERSION   AVAILABLE   PROGRESSING   SINCE   STATUS version   4.5.5     True        False         3h25m   Cluster version is 4.5.5


Build opm CLI:

$ git clone
$ cd operator-registry && make build


Create repos:

On, create one repository for the operator memcached-operator, the bundle memcached-bundle, and another for the operator registry operator-registry.

Get an existing operator, build it, and push it:

To build a custom operator, you can use operator-sdk and follow the official documentation. In our case, we will be using an existing one:


$ git clone
$ cd operator-sdk-samples/ansible/memcached-operator/
$ operator-sdk build
$ docker push


Replace image in operator deployment:

$ sed -i'.original' -e 's/REPLACE_IMAGE/quay\.io\/saberkan\/memcached-operator\:latest/g' deploy/operator.yaml


Generate custom service version:

$ operator-sdk generate csv --csv-version 1.0.0 --interactive=true
INFO[0000] Generating CSV manifest version 1.0.0
Display name for the operator (required):
> memcached-operator
Description for the operator (required):
> memcached-operator
Provider's name for the operator (required):
> saberkan
Any relevant URL for the provider name (optional):
Comma-separated list of keywords for your operator (required):
> memcached
Comma-separated list of maintainers and their emails (e.g. 'name1:email1, name2:email2') (required):
INFO[0024] CSV manifest generated successfully


Build and publish the operator bundle:

$ operator-sdk bundle create --generate-only
$ docker build -f bundle.Dockerfile -t .
$ docker push


Check bundle is valid:

$ ./operator-registry/bin/opm alpha bundle validate --tag --image-builder docker


Add the bundle into the registry image and publish it:

$ ./operator-registry/bin/opm index add --bundles --tag --build-tool docker
$ docker push


Configure Catalog Source on OpenShift:

$ cat << EOF | oc create -f -
kind: CatalogSource
name: saberkan-catalog-source
namespace: openshift-marketplace
displayName: saberkan-catalog-source
image: ''
publisher: saberkan
sourceType: grpc


Check catalog source is ready:

$ oc describe CatalogSource saberkan-catalog-source -n openshift-marketplace | grep 'Last Observed State'


Create namespace where to install the operator:

$ oc new-project saberkan


Install the operator from web console into the created namespace:

The installation can be also triggered with a subscription manifest. But we are doing it from the web console for a demo purpose:

Check operator installed (after few moments):

$ oc get csv memcached-operator.v1.0.0

NAME                        DISPLAY              VERSION   REPLACES   PHASE

memcached-operator.v1.0.0   memcached-operator   1.0.0                Succeeded