/hyperconverged-cluster-operator

Operator pattern for managing multi-operator products

Primary LanguageGoApache License 2.0Apache-2.0

Build Status Go Report Card Coverage Status

Hyperconverged Cluster Operator

The goal of the hyperconverged-cluster-operator (HCO) is to provide a single entrypoint for multiple operators - kubevirt, cdi, networking, ect... - where users can deploy and configure them in a single object. This operator is sometimes referred to as a "meta operator" or an "operator for operators". Most importantly, this operator doesn't replace or interfere with OLM. It only creates operator CRs, which is the user's prerogative.

Install OLM

NOTE OLM is not a requirement to test. Once we publish operators through Marketplace|operatorhub.io, it will be.

https://github.com/operator-framework/operator-lifecycle-manager/blob/master/Documentation/install/install.md#installing-olm

Using the HCO

NOTE Until we publish (and consume) the HCO and component operators through Marketplace|operatorhub.io, this is a means to demonstrate the HCO workflow without OLM.

Run the following script to apply the HCO operator:

$ curl https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/deploy.sh | bash

Launching the HCO through OLM

NOTE Until we publish (and consume) the HCO and component operators through Marketplace|operatorhub.io, this is a means to demonstrate the HCO workflow without OLM. Replace <docker_org> with your Docker organization as official operator-registry images for HCO will not be provided.

Build and push the converged HCO operator-registry image.

export REGISTRY_NAMESPACE=<container_org>
make bundleRegistry CONTAINER_TAG=example

Create the namespace for the HCO.

kubectl create ns kubevirt-hyperconverged

Create an OperatorGroup.

cat <<EOF | kubectl create -f -
apiVersion: operators.coreos.com/v1alpha2
kind: OperatorGroup
metadata:
  name: hco-operatorgroup
  namespace: kubevirt-hyperconverged
EOF

Create a Catalog Source.

cat <<EOF | kubectl create -f -
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: hco-catalogsource
  namespace: openshift-operator-lifecycle-manager
spec:
  sourceType: grpc
  image: docker.io/$REGISTRY_NAMESPACE/hco-registry:example
  displayName: KubeVirt HyperConverged
  publisher: Red Hat
EOF

Create a subscription.

cat <<EOF | kubectl create -f -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: hco-subscription
  namespace: kubevirt-hyperconverged
spec:
  channel: alpha
  name: kubevirt-hyperconverged
  source: hco-catalogsource
  sourceNamespace: openshift-operator-lifecycle-manager
EOF

Create an HCO CustomResource, which creates the KubeVirt CR, launching KubeVirt.

kubectl create -f deploy/converged/crds/hco.cr.yaml

Launching the HCO on a local cluster

Lunch the HCO locally for testing, experimenting and developing.

NOTE: no need to install any type of kubenetes cluster as a prerequisite.

  1. Navigate to the project's directory
$ cd <path>/hyperconverged-cluster-opertor
  1. Remove an old cluster
$ make cluster-down
  1. Create a new cluster
$ make cluster-up
  1. Clean previous HCO deployment and re-deploy HCO
    (When making a change, execute only this command - no need to repeat steps 1-3)
$ make cluster-sync

Command-Line Tool

Use ./cluster/kubectl.sh as the command-line tool. for example:

$ ./cluster/kubectl.sh get pods --all-namespaces