containerized-data-importer/doc/cdi-operator-olm.md
annastopel f634cdaa17 CDI operator OLM integration:
- Generate OLM related manifests for CDI in _out/manifests/release/olm
      OLM bundle:
	- cdi CSV manifest
	- cdi crd manifest
	- cdi package manifest
     - operatorsource manifest
     - subscription manifest
     - operatorgroup manifest
- Modify cdi-operator role not to be cluster-admin but more specific
- Move all final manifests to _out/manifests directory and update travis with new manifests location
- Provide API for vendoring CDI OLM manifests generation code

Note:
  - OLM CSV update to be supported in a separate PR
  - OLM bundle integration in travis is to be supported together with CSV update
2019-05-01 13:54:28 +03:00

4.0 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

##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
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
kubectl apply -f $GOPATH/src/github.com/operator-framework/operator-marketplace/deploy/upstream/ --validate=false

###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'

cluster/kubectl.sh get operatorsource,catalogsourceconfig,catalogsource,subscription,installplan --all-namespaces
cluster/kubectl.sh edit catalogsourceconfig.operators.coreos.com/cdi -n marketplace
  • Create CDI namespace
kubectl create ns cdi 
  • Configure namespace to be allowed to create operators there
cluster/kubectl.sh apply -f _out/manifests/release/olm/operatorgroup.yaml
  • Install subscription that will point from which channel the app is downloaded
cluster/kubectl.sh apply -f  _out/manifests/release/olm/cdi-subscription.yaml
  • 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-operator-cr.yaml

Now the operator should finish its deployment succefully

###OKD UI

  • Grant cluster-admin permissions to kube-system:default
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: kube-system-admin
  labels:
    operator.cdi.kubevirt.io: ""
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