-
Notifications
You must be signed in to change notification settings - Fork 59
Developers guide
You will need to ensure your build environment has the following dependencies installed:
- JDK 8
- Maven
- Docker
- operator-sdk 0.16.0
- git
- go 1.13
For running the operator locally, you'll also need minikube or other local k8 environment.
Use any IDE to develop, but also it's recommended to run go fmt
/ go imports
on your code before committing as we run these checks on PRs and they will fail if the code is not properly formatted.
There is not any need to build images and run operator by deploying it to Kubernetes. It is just fine to run it in e.g. IDEA directly so it connects to Kubernetes based on your configuration in ~/.k8s
. You should just run /cmd/manager/main.go
.
-
build
- meta dir for operator building -
buildenv
- build scripts used upon deployment, testing and release of images to gcr.io -
cmd
- Operator SDK directory where entry point to operator is located. -
deploy
- resources necessary in Kubernetes for successful operation functioning -
docker
- build scripts for all images, being it operator itself, Cassandra (3 or 4) and Sidecar. -
examples
- various examples showing versatility of operator -
helm
- home of Helm charts, both for Cassandra and operator -
java
- directory where custom code deployed to Cassandra as part of its image build is located -
pkg
- implementation of operator -
test
- e2s tests of operator, these tests are run as part of the pipeline in CI
The main logic for the controller portion of the Cassandra operator can be found in cmd/ and pkg/ directories and it's written in Go. Extensions / pluggins for Cassandra for Cassandra 3 and 4 respectively are located in java
directory.
Defined Kubernetes CRD objects can be found in the controller/cassandradatacenter
module.
Backup functionality is implemented via 2 components: a separate controller in controller/cassandrabackup
and a sidecar client. The sidecar client can send operation commands to the sidecar, which then performs the operations on the Cassandra via JMX. Sidcar is standalone project.
This module contains add-on components that extend Cassandra and make it easier to work and operate in a Kubernetes environment. The k8s-addon jar gets included Cassandra docker image and is dropped into the Cassandra classpath.
To build the project, compile the go project, generate images and generate relevant jars, from the project root, run:
make
This will by default build an images for your local image repo. If you wish to run the operator images (e.g. from the example yaml files or the helm package), you will need to make sure the repo, image and tag all match the docker registry you're using in your environment.
This behavior can be overridden by defining NO_DEV
, REGISTRY
and TAG
environment variables.