Difficulty: beginner
Estimated Time: 30 minutes

In the previous learning modules, we covered how to easily create the following types of Operators with the Operator SDK:

  • Go: Ideal for traditional software development teams that want to get to a fully auto-pilot Operator. It gives you the ability to leverage the same Kubernetes libraries the upstream projects uses under the hood. Check out the Go Getting Started guide.

  • Ansible: Useful for infrastructure-focused teams that have investment in Ansible modules but want to use them in a Kubernetes-native way. Also great for using Ansible to configure off-cluster objects like hardware load balancers. Check out the Ansible Getting Started guide.

We will now focus on the easiest way to get started developing an Operator:

  • Helm: Useful for securely running Helm charts without Tiller and it doesn’t rely on manual invocation of Helm to reconfigure your apps. Check out the Helm Operator Getting Started guide for more information.

Creating a CockroachDB Operator from a Helm Chart

In this tutorial, we will create a CockroachDB Operator from an existing CockroachDB Helm Chart.

CockroachDB is a distributed SQL database built on a transactional and strongly-consistent key-value store. It can:

  • Scale horizontally.
  • Survive disk, machine, rack, and even datacenter failures with minimal latency disruption and no manual intervention.
  • Supports strongly-consistent ACID transactions and provides a familiar SQL API for structuring, manipulating, and querying data.

Let's begin!

Thank you for taking a closer look at Operator SDK's Helm Operator. For more information, check out the links below:

GitHub

Chat

Operator SDK with Helm

Step 1 of 9

Initialize the Project

Let's begin my creating a new project called myproject:

oc new-project myproject


Let's now create a new directory in our $GOPATH/src/ directory:

mkdir -p $GOPATH/src/github.com/redhat/


Navigate to the directory:

cd $GOPATH/src/github.com/redhat/


Create a new Helm-based Operator SDK project for the CockroachDB Operator:

operator-sdk new cockroachdb-operator --type=helm --helm-chart cockroachdb --helm-chart-repo https://kubernetes-charts.storage.googleapis.com


Navigate to the top-level project directory:

cd cockroachdb-operator


Project Scaffolding Layout

After creating a new operator project using operator-sdk new --type helm, the project directory has numerous generated folders and files. The following table describes a basic rundown of the generated files and directories:

File/Folders Purpose
deploy Contains a generic set of Kubernetes manifests for deploying this operator on a Kubernetes cluster.
helm-charts/ Contains a Helm chart initialized using the equivalent of [helm create][docs_helm_create]
build Contains scripts that the operator-sdk uses for build and initialization.
watches.yaml Contains Group, Version, Kind, and Helm chart location.