The openGauss-operator uses the client-go library to develop a custom controller monitoring, scheduling and updating openGauss cluster in kubernetes.
Use prometheus to monitor the pod and node status.
Follow kube-prometheus quick start to install prometheus stack.
Before generating code, make sure your project is in a directory with path xxx/github.com/waterme7on/
.
Fetch code-generator repo and execute script.
go mod vendor
./hack/update-codegen.sh
Fetch the project
git clone https://github.com/waterme7on/openGauss-operator.git
cd openGauss-operator
Build and Run in Process
go build -o controller .
# kubeconfig won't be needed if run in-cluster
./controller -kubeconfig=$HOME/.kube/config
Or Run in Deploymente
kubectl apply -f manifests manifests/serviceaccount.yaml
kubectl apply -f manifests/deploy.yaml
Create Crd and example OpenGauss cluster
# create openGauss CustomResourceDefination
kubectl create -f manifests/crd.yaml
# create a openGauss object
kubectl create -f example/opengauss.yaml
Check status
# check all the components of opengauss defined by example
kubectl get all | grep opengauss
Add new master
# connect to mycat with mysql client, default user "mycat" and password "123456"
# create table using mysql client
# example in example/opengauss.yaml and example/opengauss-new-master.yaml
data flow and logic graph
components
- modify
- git checkout -b xxx
- git push origin xxx:feat_xxx
- pull request
Use code-generator to update code if you want to modify openGauss apis.
You may need to manually install code-generator or use command go mod vendor
to create and populate vendor
diretory to get the source file.
Build command:
# get the code-generator
go mod vendor
# or use command "go get k8s.io/code-generator"
# update apis
bash hack/update-codegen.sh
# then build and run
how the various components in the client-go library work and their interaction points with the custom controller code
For protoc installation and instructions, see grpc in go
cd rpc
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative protobuf/clients.proto