operatorhub

by joaquinito2051

Helm chartv0.0.12App 1.0.0

A Helm chart to create OperatorHub subscriptions

About this chart

OperatorHub

OperatorHub is a central location to find the wide array of great Operators that have been built by the community. Packaging of the Operators indexed in OperatorHub.io relies on the Operator Lifecycle Manager (OLM) to install, manage and update Operators consistently on any Kubernetes cluster.

The OperatorHub and OLM are available via the OpenShift Container Platform web console as well and is the interface that cluster administrators use to discover and install Operators.

Introduction

This chart enables specific operators as it creates a subscription for the specific operator. For this, it creates a Subscription resource instance and a OperatorGroup for the relevant operator's subscription. A ClusterServiceVersion (CSV) is created automatically since the value of CSV is set in the Subscription, so all of the custom resources relevant to the operator are created.

If installModes are specified, then the CSV object is patched accordingly.

If the namespaceSelector is set, then instead of targeting just the own Nnamespace, the operator will select multiple NS based on the label provided.

Installing the chart

To add the chart repo:

$ helm repo add rht-labs https://rht-labs.github.io/rht-labs

After adding the chart repo, create a YAML file to specify the overrides in the following structure:

namespace: operator-namespace
operators:
  - name: subscription-name
    subscription:
      channel: operator-channel
      approval: approval-type
      operatorName: operator-name
      sourceName: catalog-source
      sourceNamespace: catalog-source-namespace
      csv: optional-catalog-source-version
    operatorgroup:
      create: true

Change the values regarding to the operator you want to use. (See the Configuration section for the overrides' descriptions.)

To install the chart:

$ helm install -f custom-values.yaml rht-labs/operatorhub

Or you can just pass custom parameters without creating a YAML file:

$ helm install rht-labs/operatorhub --set operators[0].name=OPERATOR_NAME,operators[0].namespace=OPERATOR_NAMESPACE ... (set all the mandatory variables)

For more info about overriding variables see: Customizing the chart

Uninstalling the chart

To uninstall/delete the deployment:

$ helm uninstall <name of chart>

Configuration

The following table lists the configurable parameters of the OperatorHub chart and their default values.

Parameter (For each operator)DescriptionDefault
nameName of the Subscription
namespaceThe namespace the Subscription will be created in
subscription.channelOperator's subscription channel which is specific for the operator
subscription.approvalSubscription's install plan approvalAutomatic
subscription.operatorNameName of the operator
subscription.sourceNameOperator's source which the operator belongs toredhat-operators
subscription.sourceNamespaceOperator's namespace where the operator will be pulled fromopenshift-marketplace
subscription.csvClusterServiceVersion's name which will be created regarding to the operator
operatorgroup.createAn OperatorGroup will be created with the same name of the Subscription if the value is truetrue
operatorgroup.namespaceSelectorOptional. (It will be deprecated in futures releases). An OperatorGroup namespace Selector in case your operator needs to watch more than one ns. Example: "monitoring: yes".
operatorgroup.installModes:Optional. Change operator install modes in the ClusterServiceVersion object.

Prometheus Operator example, with namespaceSelector and installModes:

namespace: prometheus-operator
operators:
  - name: prometheus-operator
    subscription:
      channel: beta
      approval: Automatic
      operatorName: prometheus
      sourceName: community-operators
      sourceNamespace: openshift-marketplace
      csv: prometheusoperator.0.37.0
    operatorgroup:
      create: true
      namespaceSelector: 'labelKey: LabelValue'
    installModes:
      OwnNamespace: true
      SingleNamespace: false
      MultiNamespace: true
      AllNamespaces: false

Deploy operatorhub with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has operatorhub on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartoperatorhub is pinned at v0.0.12 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply