Skip to content

Instantly share code, notes, and snippets.

@tsisodia10
Last active April 22, 2022 18:47
Show Gist options
  • Save tsisodia10/074233ad961e9db5312fdb4e8ab38616 to your computer and use it in GitHub Desktop.
Save tsisodia10/074233ad961e9db5312fdb4e8ab38616 to your computer and use it in GitHub Desktop.
Deploy MSO using OLM on Openshift 4.9

MSO Deployment with OLM

The steps have been tried on OpenShift 4.9

Clone the MSO Repository

Clone and cd into directory of the repo.

git clone git@github.com:rhobs/monitoring-stack-operator.git

cd monitoring-stack-operator

Login into QUAY

You will need a quay.io account and docker installed on your local machine.

docker login quay.io

Export environment variables

IMAGE_BASE and VERSION needs to be exported before building an image.

export IMAGE_BASE = quay.io/<your_quay_username>/monitoring-stack-operator

eg: export IMAGE_BASE = quay.io/tsisodia10/monitoring-stack-operator

export VERSION = 0.0.1

Building and pushing images to quay

We need to build Operator, Bundle, Catalog images and push it to our quay repository.

IMAGE_BASE=quay.io/tsisodia10/monitoring-stack-operator make release

You'll see similar output like this -

...
docker build -f build/Dockerfile . -t quay.io/tsisodia10/monitoring-stack-operator:0.0.1
...
docker push quay.io/tsisodia10/monitoring-stack-operator:0.0.1
...
docker build -f bundle.Dockerfile . -t quay.io/tsisodia10/monitoring-stack-operator-bundle:0.0.1
...
docker push quay.io/tsisodia10/monitoring-stack-operator-bundle:0.0.1
...
docker build -f catalog.Dockerfile . -t quay.io/tsisodia10/monitoring-stack-operator-catalog:0.0.1
...
docker push quay.io/tsisodia10/monitoring-stack-operator-catalog:0.0.1

Inside quay.io repository

Quay should have 3 images listed as below -

REPOSITORY NAME 	                             LAST MODIFIED 	        ACTIVITY 	STAR 
tsisodia10/monitoring-stack-operator-catalog	 Yesterday at 1:57 PM		
tsisodia10/monitoring-stack-operator-bundle	   Yesterday at 1:57 PM		
tsisodia10/monitoring-stack-operator	         Yesterday at 1:57 PM		

Add resources

For this you need to first have Openshift cluster up and running.

  1. Apply Catalog source
# Apply this to add a new catalog to OLM
---
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  annotations:
  name: monitoring-operators
  namespace: openshift-marketplace
spec:
  displayName: Monitoring Test Operator
  icon:
    base64data: ""
    mediatype: ""
  image: quay.io/tsisodia10/monitoring-stack-operator-catalog:latest
  publisher: Twinkll Sisodia
  sourceType: grpc
  updateStrategy:
    registryPoll:
      interval: 1m0s
oc create -f hack/olm/catalog-src.yaml
  1. On Openshift UI
  • Navigate to Openshift UI ---> OperatorHub and Search for Monitoring Stack Operator
  • Install the operator with development channel
  • Navigate to Installed operators and you'll see the monitoring stack operator getting installed
  • Once installed, you can create monitoring-stack starburst instance
apiVersion: monitoring.rhobs/v1alpha1
kind: MonitoringStack
metadata:
  name: starburst
spec:
  logLevel: debug # debug 

Once the monitoringStack instance is up and running, Prometheus AlertManager and Grafana would be available and you can access those components under Networking --> Routes

@cmwylie19
Copy link

cmwylie19 commented Apr 22, 2022

Workaround Notice

Under the "You'll see similar output like this -" block

If you see an output similar to this -

/Users/cmwylie19/Public/monitoring-stack-operator/tmp/bin/opm index add \
                --container-tool docker \
                --mode semver \
                --tag quay.io/tsisodia10/monitoring-stack-operator-catalog:latest \
                --bundles quay.io/tsisodia10/monitoring-stack-operator-bundle:0.0.2 
INFO[0000] building the index                            bundles="[quay.io/tsisodia10/monitoring-stack-operator-bundle:0.0.2]"
Error: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub

Then we need to change the way the opm command is run. First, install OPM. The docs on how to install OPM can be found here.

Once installed, edit line 182 of the makefile where it references $(OPM), change it to use the binary opm in your path.

opm index add \
                --container-tool docker \
                --mode semver \
                --tag quay.io/tsisodia10/monitoring-stack-operator-catalog:latest \
                --bundles quay.io/tsisodia10/monitoring-stack-operator-bundle:0.0.2

After you run make release IMAGE_BASE=quay.io/tsisodia10/monitoring-stack-operator make release, change the makefile back to the original version for consistency. This has worked for us to successfully work around the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment