Skip to content

Latest commit

 

History

History
145 lines (124 loc) · 6 KB

README.md

File metadata and controls

145 lines (124 loc) · 6 KB

Install Using OLM with Morpheus Catalog

In Order to support seamless upgrades of the operator with new versions, need to create a catalog source of bundles containing list of bundles , and at least one channel, and a sequenced upgrade graph.

Creating the Morpheus Operator Catalog

Steps

  1. Create directory for morpheus catalog:
mkdir -p morpheus-catalog
  1. Create the catalog yaml using opm:
opm init morpheus-operator --default-channel=alpha --description=../README.md --output yaml >morpheus-catalog/operator.yaml
  1. Render first bundle into the catalog:
opm render quay.io/zgrinber/morpheus-operator-bundle:v0.0.2 --output=yaml >> morpheus-catalog/operator.yam
  1. Add alpha channel definition into the catalog yaml file, containing the bundle we just rendered into the catalog:
 cat << EOF >> morpheus-catalog/operator.yaml
---
schema: olm.channel
package: example-operator
name: alpha
entries:
  - name: morpheus-operator-bundle.v0.0.2
EOF
  1. Validate the catalog ( should return nothing, verbose response means there is an error):
opm validate morpheus-catalog
# should print 0.
echo $?
  1. Build the catalog index image and push it to a container registry ( make sure the image is public in the container registry' server side)
podman build . -f morpheus-catalog.Dockerfile -t quay.io/zgrinber/morpheus-catalog:latest
podman push quay.io/zgrinber/morpheus-catalog:latest

First Deployment of Operator

  1. Create new project
oc new-project morpheus-operator
  1. Create new operator group to target all namespaces for operator's permissions
oc apply -f morpheus-og.yaml

Note: This operator depends on Nvidia GPU drivers installed by NVIDIA GPU Operator, If you don't have it already installed on your Openshift Cluster, Kindly install on cluster manually, or deploy the Morpheus operator in OwnNamespace installMode As this is the only installMode that the NVIDIA GPU Operator supports - this will automatically deploy the GPU Operator ( Starts looking from Version 3.9.1) before the Morpheus Operator will be deployed To Achieve that, you need to edit the operatorgroup file before applying it to the cluster that way:

apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
    name: morpheus-og
# Comment Out to disable ownNamespace installMode ( required to enable automatic installation of Nvidia GPU Operator    
spec:
  targetNamespaces:
  - morpheus-operator
  1. Create a new catalog source and waits for a registry pod to come up in order to serve the budnles from the catalog
oc apply -f morpheus-catalog-source.yaml
oc get pods 

Expected outputs:

NAME                     READY   STATUS    RESTARTS   AGE
morpheus-catalog-9kn5k   1/1     Running   0          24s
  1. Create a subscription to install the operator via subscribing to morpheus catalog' alpha channel
oc apply -f morpheus-subscription.yaml
  1. Wait for the operator to get installed
 oc get csv morpheus-operator.v0.0.2 -w

Expected output

morpheus-operator.v0.0.2                  morpheus-operator                0.0.2                                                       Pending
morpheus-operator.v0.0.2                  morpheus-operator                0.0.2                                                       InstallReady
morpheus-operator.v0.0.2                  morpheus-operator                0.0.2                                                       Installing
morpheus-operator.v0.0.2                  morpheus-operator                0.0.2                                                       Installing
morpheus-operator.v0.0.2                  morpheus-operator                0.0.2                                                       Installing
morpheus-operator.v0.0.2                  morpheus-operator                0.0.2                                                       Succeeded
  1. check that the operator is running
oc get pods

Expected output:

NAME                                                              READY   STATUS      RESTARTS   AGE
b0d4d492ec89774cd2f5981897b8c08ea938452f139888541102b7b4989r7g2   0/1     Completed   0          113s
morpheus-catalog-9kn5k                                            1/1     Running     0          3m13s
morpheus-operator-controller-manager-58dc8dc97f-plg6p             2/2     Running     0          88s

Upgrade of catalog with new bundle

Pre-requisite

Before performing this process, you should first create a new image version of the operator + new operator bundle image, please follow These Section Steps 1-4

  1. Render the new Morpheus Operator bundle version ( for example, v0.0.3)
 opm render quay.io/zgrinber/morpheus-operator-bundle:v0.0.4 --output=yaml > new-operator.yaml
  1. Add this bundle to the catalog
export LINE_NUMBER=$(grep -n -E "schema: olm.bundle[[:blank:]]*"  morpheus-catalog/operator.yaml | tail -n 1 | awk -F ':' '{print $1}')
let "targetLine = $LINE_NUMBER + 1"
sed  "${targetLine}i: &&&/" morpheus-catalog/operator.yaml | sed '/&&&/ r new-operator.yaml' | sed '/&&&/d' | tee temp.yaml
  1. Add new Update graph from last version to new version
echo '[{"name": "morpheus-operator.v0.0.4","replaces": "morpheus-operator.v0.0.3" }]'  | yq -P | awk '{print"  " $0}' >> temp.yaml
mv temp.yaml morpheus-catalog/operator.yaml
rm new-operator.yaml
  1. Build the updated catalog index image and push it to a container registry and override latest ( make sure the image is public in the container registry' server side)
podman build . -f morpheus-catalog.Dockerfile -t quay.io/zgrinber/morpheus-catalog:latest
podman push quay.io/zgrinber/morpheus-catalog:latest