dbaas-operator

command module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

README

OpenShift Database Access Operator

OpenShift Database Access Operator (a.k.a. DBaaS Operator) is currently iterating early releases. The intent of these releases is to show how we could create trail database cluster, scan & import off-cluster cloud database instances hosted by various 3rd party ISV providers & make those instances available to developers for binding to their applications.

Architecture Diagram

Conceptual Diagram of the Components

Documentation

Associated Github Repositories

Component Git Repo Description
DBaaS Console Plugin DBaaS Dynamic Plugin DBaaS UI console plugin, creation for “Provider Account” and a bindable “Connection” resource.
Crunchy Bridge Operator Crunchy Bridge PostgreSQL Operator responsible for establishing API communications with Crunchy Bridge Managed Postgres Database.
CockroachCloud Operator CockroachCloud Operator Operator responsible for establishing API communications with CockroachCloud Provider Platform.
Service Binding Operator Service Binding Operator Red Hat operator for binding resources together via Topology View.
RDS Operator RDS Operator Operator for Amazon RDS building on top of ACK (AWS Controller for Kubernetes).
Observability Operator Observability Operator Operator for installing the monitoring stack and configuring remote write Observatorium.

Building the Operator

Requires:

  • go v1.18
  • operator-sdk v1.22.2

Build the OpenShift Database Access Operator image and its bundle and catalog images and push them to a public registry, such as quay.io:

  • ORG=<YOUR_QUAY_USER> VERSION=<version> make release-build release-push

If you are using podman instead of docker:

  • CONTAINER_ENGINE=podman ORG=<YOUR_QUAY_USER> VERSION=<version> make release-build release-push

You can also build and push the image to a public registry other than quay.io:

  • REGISTRY=<YOUR_REGISTRY> VERSION=<version> make release-build release-push

Running the Operator (requires OCP 4.10 or higher)

NOTE: The DBaaS console UI portion of the workflow described below will only work if your operator is installed via OLM and using version OpenShift Container Platform (OCP) version 4.10 or higher. If you run locally or via direct deploy (no longer recommended), you can create a DBaaSInventory. DBaaSConnection CRs created directly in command line can appear in the topology view in the OpenShift Console.

Deploy via OLM on cluster:

  • Make visibility of the repositories (dbaas-operator, dbaas-operator-bundle, and dbaas-operator-catalog) public in your Quay.io account
  • ORG=<YOUR_QUAY_USER> VERSION=<version> make catalog-update
  • Access to an OpenShift and navigate in the web console to the Operators → OperatorHub page.
  • Scroll or type a keyword into the Filter by keyword box OpenShift Database Access Operator click Install. The DBaaS operator is cluster scope and the default installed namespace is openshift-dbaas-operator.
  • On successful installation of DBaaS operator, will automatically install all its dependencies and the operator logs shows: DBaaS platform stack installation complete.
  • Continue below by following the Using the Operator section
  • If you wish to uninstall operator and dependencies from your cluster: delete dbaas-platform(DBaaSPlatform) CR manually wait for the operator to uninstall its dependencies and then uninstall the DBaaS operator by going →Operators → Installed Operators → Actions → Uninstall Operator. Then delete the catalog source.

Using the Operator

Prerequisites:

  • Either OpenShift Container Platform or Origin Kubernetes Distribution (OKD) 4.10 or higher.
  • Installation of the OpenShift Database Access operator.
  • A service account with either the Crunchy Data Bridge, or CockroachDB, or Amazon RDS cloud-hosted database provider.

Creating a DBaaSInventory:

  1. From the OpenShift console home page, in the Administrator perspective, click Operators, then click Installed Operators.

  2. Set the Project to openshift-dbaas-operator.

  3. Click the OpenShift Database Access Operator tile to view the details page.

  4. Click the Provider Account tab.

  5. Click the Create DBaaSInventory button to create a new provider account.

    NOTE: Refresh the page if you are not seeing the DBaaS Console UI, this requires a one-time only plugin reload.

  6. On the Import Provider Account page, select a Database provider, provide the credentials for your choosen cloud-hosted database provider, and specify a name for the new provider account resource. provider account creation

  7. Click the Import button to create the provider account resource, and fetch the available database instances.

  8. If fetching is successful, then you see can the exposed database instances that developers can import, or you can click the View Provider Accounts button to return to the provider account's DBaaSInventorys page. Click the link to view an IT Operations preview demo of OpenShift Database Access.

Creating a DBaaSConnection:

  1. From the OpenShift console home page, switch to the Developer perspective.
  2. Click +Add.
  3. Select or create a project for your application where you want to add a database to. Here is sample Quarkus application deployment for Crunchy Bridge.
  4. Click the Cloud-hosted Database category. database-provider
  5. Select the cloud-hosted database provider tile, and click Add to Topology.
    connect-database
  6. Select the database instance name, and click Add to Topology.
    connection-list
  7. Upon a successful connection, you are taken to the Topology page.
  8. Click and drag the arrow from the application to the new database instance to create a binding connector. topology-view Click the link to view a Developer preview demo of OpenShift Database Access.

API Reference

Contributing

  • Fork OpenShift Database Access Operator repository
  • Check out code from your new fork
    • git clone git@github.com:<your-user-name>/dbaas-operator.git
    • cd dbaas-operator
  • Add upstream as git remote entry
    • git remote add upstream git@github.com:RHEcosystemAppEng/dbaas-operator.git
  • create feature branches within your fork to complete your work
  • raise PR's from your feature branch targeting upstream main branch
  • add jeremyary (and others as needed) as reviewer

Appendix

Go Installation
  • If the go installation version on your dev machine is different from the one required e.g. go1.18, visit the go.dev/dl
  • Download the installer package for the needed version e.g. go1.18.x and follow official go installation instructions
  • Verify the go installation is successful
Alternatively - Run as a local instance
  • make install run INSTALL_NAMESPACE=<your_target_namespace> ENABLE_WEBHOOKS=false
  • Continue below by following the Using the Operator section
  • When finished, remove created resources via:
    • make clean-namespace
Deploy & run on a cluster
  • oc project <your_target_namespace>
  • make deploy
  • Continue below by following the Using the Operator section
  • When finished, clean up & remove deployment via:
    • make clean-namespace undeploy

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the dbaas v1alpha1 API group +kubebuilder:object:generate=true +groupName=dbaas.redhat.com
Package v1alpha1 contains API Schema definitions for the dbaas v1alpha1 API group +kubebuilder:object:generate=true +groupName=dbaas.redhat.com
v1beta1
Package v1beta1 contains API Schema definitions for the dbaas v1beta1 API group +kubebuilder:object:generate=true +groupName=dbaas.redhat.com
Package v1beta1 contains API Schema definitions for the dbaas v1beta1 API group +kubebuilder:object:generate=true +groupName=dbaas.redhat.com

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL