Skip to content

Latest commit

 

History

History
114 lines (81 loc) · 3.2 KB

README.md

File metadata and controls

114 lines (81 loc) · 3.2 KB

spanner-operator

Spanner operation client for Cloud Spanner Administrator.
This repo is based on sample-controller.
This is an experimental project of my own practice creating custom controller.

Features

  • Create/Update/Delete instance
  • Create/Delete database
  • Scale instance node count

Installation

⚡ Notes
Currently I've only tested on my local machine by using minikube.

Running controller

cd /path/to/this/repo
go build -o controller
./controller -kubeconfig ~/.kube/config (-use-mock: use mock client) (-debbugable: debug log)

Install CRD

cd /path/to/this/repo
cd ./artifacts/crd
kubectl apply -f crd.instance.yml
kubectl apply -f crd.database.yml

Running sample

cd /path/to/this/repo
cd ./artifacts/sample
kubectl apply -f sample.instance.yml // Create instance
kubectl apply -f sample.database.yml // Create database

Get SpannerInstance

kubectl get spi

Output:

NAME      NODECOUNT   INSTANCECONFIG             AGE
testing   1           regional-asia-northeast1   4s

Get SpannerDatabase

kubectl get spd

Output:

NAME     INSTANCEID   AGE
testdb   testing      3s

Scale SpannerInstance

kubectl scale spi --replicas 3 testing

Output:

kubectl get spi
----------
NAME      NODECOUNT   INSTANCECONFIG             AGE
testing   3           regional-asia-northeast1   3m56s

Plans

  • Implement custom metrics server

References

About custom controller

About autoscaling

About custom metrics