/integreatly-operator

An Openshift Operator based on the Operator SDK for installing and reconciling Integreatly services

Primary LanguageGoApache License 2.0Apache-2.0

codecov

Integreatly Operator

A Kubernetes Operator based on the Operator SDK for installing and reconciling managed products.

An Integreatly Operator can be installed using three different flavours: managed-api or multitenant-managed-api

To switch between the three you can use export the INSTALLATION_TYPE env or use it in conjunction with any of the make commands referenced in this README

Installed products

The operator installs the following products:

managed-api

  • 3scale
  • RHSSO (both a cluster instance, and a user instance)
  • Marin3r

multitenant-managed-api

  • 3scale
  • RHSSO (cluster instance)
  • Marin3r

Prerequisites

  • operator-sdk version v1.21.0.
  • go version 1.18+
  • moq
  • oc version v4.6+
  • yq version v4.30+
  • jq
  • promtool
  • Access to an Openshift v4.6.0+ cluster
  • A user with administrative privileges in the OpenShift cluster

After installation, the following commands must be run to avoid a known issue related to the Moq package:

make code/compile
go install github.com/matryer/moq

Local Development

Ensure that the cluster satisfies minimal requirements:

  • RHOAM (managed-api and multitenant-managed-api): 18 vCPU. More details can be found in the service definition under the "Resource Requirements" section Note: The LOCAL flag is set to true by default, this means the namespace used to install RHOAM will be set to local-rhoam-operator and other RHOAM related namespaces will be prefixed with local-rhoam. If you wish to use non-local namespaces then set LOCAL to false by running the following command export LOCAL=false.

1. Clone the integreatly-operator

Only if you haven't already cloned. Otherwise, navigate to an existing copy.

mkdir -p $GOPATH/src/github.com/integr8ly
cd $GOPATH/src/github.com/integr8ly
git clone https://github.com/integr8ly/integreatly-operator
cd integreatly-operator

2. Cluster size guidelines

For development work the required vcpu and ram can be lower than that stated in the service definition. Different quotas require different values. Table belong are typical requested values needed for RHOAM on a cluster with cluster storage set to True.

Quota vCPU RAM
100 Thousand 6.5 vCPU 22 Gb
1 Million 6.5 vCPU 22 Gb
5 Million 8 vCPU 24 Gb
10 Million 8.5 vCPU 24 Gb
20 Million 9.5 vCPU 24 Gb
50 Million 14 vCPU 26.5 Gb

3. Prepare your cluster

If you are working against a fresh cluster it will need to be prepared using the following. Ensure you are logged into a cluster by oc whoami. Include the INSTALLATION_TYPE. See here about this and other optional configuration variables.

INSTALLATION_TYPE=<managed-api/multitenant-managed-api> make cluster/prepare/local

4. Configuration (optional)

If you are running RHOAM against a cluster which is smaller than the requirements listed above, you should use the IN_PROW variable, otherwise the installation will not complete. If you have a cluster which meets the requirements, this step can be skipped. Please see the table below for other configuration options.

INSTALLATION_TYPE=managed-api IN_PROW=true USE_CLUSTER_STORAGE=<true/false> make deploy/integreatly-rhmi-cr.yml
Variable Options Type Default Details
INSTALLATION_TYPE managed-api or multitenant-managed-api Required managed-api Manages installation type. managed-api for RHOAM. multitenant-managed-api for Multitenant RHOAM.
IN_PROW true or false Optional false If true, reduces the number of pods created. Use for small clusters
USE_CLUSTER_STORAGE true or false Optional true If true, installs application to the cloud provider. Otherwise installs to the OpenShift.
LOCAL true or false Optional true If true, uses local-rhoam-operator as default namespace.

5. Run integreatly-operator

Include the INSTALLATION_TYPE if you haven't already exported it. The operator can now be run locally:

INSTALLATION_TYPE=<managed-api/multitenant-managed-api> make code/run

If you want to run the operator from a specific image, you can specify the image and run make cluster/deploy

IMAGE_FORMAT=<image-registry-address> INSTALLATION_TYPE=managed-api  make cluster/deploy

Note: if the operator doesn't find an RHMI cr, it will create one (Name: rhoam).

Variable Options Type Default Details
PRODUCT_DECLARATION File path Optional ./products/installation.yaml Specifies how RHOAM install the product operators, either from a local manifest, an index, or an included bundle. Only applicable to RHOAM

6. Validate installation

Use following commands to validate that installation succeeded:

For RHOAM (managed-api): oc get rhmi rhoam -n redhat-rhoam-operator -o jsonpath='{.status.stage}{"\n"}'

For RHOAM Multitenant (multitenant-managed-api): oc get rhmi rhoam -n sandbox-rhoam-operator -o jsonpath='{.status.stage}{"\n"}'

Once the installation completed the command wil result in following output:

"complete"

Uninstalling RHOAM

Local and OLM installation type

If you installed RHOAM locally or via OLM then you can uninstall one of two ways:

  • for local installation use the local-rhaom-operator Namespace
  • for OLM installation use the redhat-rhoam-operator Namespace

A) Create a configmap and add a deletion label (Preferred way of uninstallation).

oc create configmap managed-api-service -n <NAMESPACE>
oc label configmap managed-api-service api.openshift.com/addon-managed-api-service-delete=true -n <NAMESPACE>

B) Delete the RHOAM cr.

oc delete rhmi rhoam -n <NAMESPACE>

In both scenarios wait until the RHOAM cr is removed and then run the following command to delete the namespace.

oc delete namespace <NAMESPACE>

Note: After uninstalling RHOAM you should clean up the cluster by running the following command.

Local installation
make cluster/cleanup && make cluster/cleanup/crds
OLM installation
LOCAL=false make cluster/cleanup && make cluster/cleanup/crds

More Info

More info can be found in the docs folder and at the Integreatly Read the Docs site.