containerized-data-importer/doc/cdi-operator-olm.md
annastopel ef736401fa BugFix:
- CDI OLM manifests API
           assign correct defaukt names for cdi container images in FillDefaults method
      - tuned cdi-operator rbac
           1. tuned securityconstraints permission for priviledged and not
           2. added permission for get and list of storagclass resource
      - md file fixes
2019-05-15 22:08:09 +03:00

4.8 KiB

OLM (Operator Lifecycle Management) intergartion

OLM Overview

https://github.com/kubevirt/kubevirt/blob/master/docs/devel/olm-integration.md

CDI OLM manifests

  1. Generate OLM manifests
DOCKER_REPO=<repo> DOCKER_TAG=<docker tag> PULL_POLICY=<pull policy> VERBOSITY=<verbosity> CSV_VERSION=<CSV version> QUAY_NAMESPACE=<namespace> QUAY_REPOSITORY=<application name> make manifests

The generated final olm manifests will be located in out/manifests/release/olm/bundle/ directory

Note: there is a structure of operator related manifest

  • manifests/release - contains operator manifests that can be deployed without olm
  • manifests/olm - contains additional auxilary manifests that are required when deploying with olm and with olm marketplace
  • manifests/olm/bundle - contains olm bundle that is to be pushed to quay.io and consumed by marketplace operator
  1. Verify generated manifests
make olm-verify
  1. Push the generated verified manifests to quay.io
CSV_VERSION=<CSV version>  QUAY_USERNAME=<quay account username> QUAY_PASSWORD=<quay account password> QUAY_NAMESPACE=<namespace> QUAY_REPOSITORY=<application name> make olm-push

Containerized Data Importer (CDI) OLM installation

Prerequisites

Build OLM manifests and push them to quay

  • Build OLM manifests and push to quay. Specify your DOCKER_REPO, DOCKER_TAG, QUAY_NAMESPACE, QUAY_REPOSITORY, CSV_VERSION.
DOCKER_REPO=<repo> DOCKER_TAG=<docker tag> PULL_POLICY=<pull policy> VERBOSITY=<verbosity> CSV_VERSION=<CSV version> QUAY_NAMESPACE=<namespace> QUAY_REPOSITORY=<application name> make manifests
  • Push OLM bundle to quay. Provide QUAY_NAMESPACE, QUAY_REPOSITORY, QUAY_USERNAME, QUAY_PASSWORD, CSV_VERSION
QUAY_NAMESPACE=<quay namespace> QUAY_REPOSITORY=<quay repo> QUAY_USERNAME=<quay username> QUAY_PASSWORD=<quay password> CSV_VERSION=<csv version > make olm-push

Install OLM and marketplace operators on cluster

  • Install OLM operator from cloned operator-lifecycle-manager repo and wait untill all pods are Running and Ready.
kubectl apply -f $GOPATH/src/github.com/operator-framework/operator-lifecycle-manager/deploy/upstream/quickstart/olm.yaml
  • Install marketplace operator from cloned operator-marketplace repo and wait until all pods are Running and Ready.
kubectl apply -f $GOPATH/src/github.com/operator-framework/operator-marketplace/deploy/upstream/ --validate=false
  • Wait till marketplace-operator is Running and Ready.
kubectl get pods -n marketplace 
NAME                                   READY   STATUS    RESTARTS   AGE
cdi-7c7fc4f774-bdbsh                   1/1     Running   0          37s
marketplace-operator-d8cc985d4-mv7xp   1/1     Running   0          2m40s

CDI installation by means of OLM and marketplace operators

  • Install CDI operatorsource manifest that specifies the location of CDI OLM bundle in quay
kubectl apply -f _out/manifests/release/olm/cdi-operatorsource.yaml
  • Handle marketplace namespace workarouond

    Move catalogsourceconfig.operators.coreos.com/cdi from markeplace namespace to olm namespace by modifying targetNamespace field to 'olm' from 'marketplace'

kubectl get operatorsource,catalogsourceconfig,catalogsource,subscription,installplan --all-namespaces
kubectl edit catalogsourceconfig.operators.coreos.com/cdi -n marketplace
  • Create CDI namespace
kubectl create ns cdi 
  • Configure namespace to be allowed to create operators there
kubectl apply -f _out/manifests/release/olm/operatorgroup.yaml
  • Install subscription that will point from which channel the app is downloaded
kubectl apply -f  _out/manifests/release/olm/cdi-subscription.yaml
  • Verify CDI installation plan was created
kubectl get operatorsource,catalogsourceconfig,catalogsource,subscription,installplan -n cdi
NAME                                    PACKAGE   SOURCE   CHANNEL
subscription.operators.coreos.com/cdi   cdi       cdi      beta

NAME                                             CSV                 SOURCE   APPROVAL    APPROVED
installplan.operators.coreos.com/install-995l9   cdioperator.0.0.0            Automatic   true

  • Now cdi-operator starts running but in order for it to succeed we need to deploy cdi cr
cluster/kubectl.sh apply -f  _out/manifests/release/cdi-cr.yaml

Now the operator should finish its deployment successfully

OKD UI

  • Grant cluster-admin permissions to kube-system:default
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: kube-system-admin
subjects:
- kind: ServiceAccount
  name: default
  namespace: kube-system
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: ""
  • Start OKD UI
cd $GOPATH/src/github.com/operator-lifecycle-manager/scripts/
./run_console_local.sh