db-operator

module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: Apache-2.0

README

DB Operator

The DB Operator eases the pain of managing PostgreSQL and MySQL instances for applications running in Kubernetes. The Operator creates databases and make them available in the cluster via Custom Resource. It is designed to support the on demand creation of test environments in CI/CD pipelines.

Features

DB Operator provides following features:

  • Create/Delete databases on the database server running outside/inside Kubernetes by creating Database custom resource;
  • Create Google Cloud SQL instances by creating DbInstance custom resource;
  • Automatically create backup CronJob with defined schedule (limited feature);

Documentations

Quickstart

TODO: update when public helm repo set up done to not use local helm chart

To install DB Operator with helm:
$ helm repo add myhelmrepo https://kloeckner-i.github.io/db-operator/helm/
$ helm install --name my-release myhelmrepo/db-operator

To see more options of helm values here

Development

Prerequisites

To have kubernetes environment locally, you can set minikube or microk8s up.

makefile help
make miniup: start minikube
make minidown: stop minikube
make minidelete: delete minikube
make minidashboard: open minikube dashboard
make build: build db-operator docker image using operator-sdk
make helm: install helm if not exist and install local chart using helm upgrade --install command
make setup: build db-operator image, install helm
make update: build db-operator image again and delete running pod
make addexamples: kubectl create -f examples/
make test: spin up mysql, postgres containers and run go unit test
make microsetup: install microk8s locally and deploy db-operator (only for linux)
Developing with Minikube
How to run db-operator
$ make miniup
$ make setup
After code changes

rebuild local docker image

$ make build

delete running db-operator and apply new image

$ make deploy

or both at once

$ make update
After helm template changes
$ make helm

helm upgrade --install -f {LOCAL CHART DIR}/values-local.yaml {LOCAL CHART DIR}

Developing with microk8s
  • Microk8s supports only linux environment. Non linux user can use microk8s using vm for example multipass. Please find details here
How to run db-operator
$ make microsetup

microsetup is used for our integration test in pipeline.

Run unit test locally
$ make test

Directories

Path Synopsis
cmd
pkg
apis/kci
Package kci contains kci API versions.
Package kci contains kci API versions.
apis/kci/v1alpha1
Package v1alpha1 contains API Schema definitions for the kci v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=kci.rocks Package v1alpha1 contains API Schema definitions for the kci v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=kci.rocks
Package v1alpha1 contains API Schema definitions for the kci v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=kci.rocks Package v1alpha1 contains API Schema definitions for the kci v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=kci.rocks

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳