openGauss-operator

command module
v0.0.0-...-82ad568 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 51 Imported by: 0

README

openGauss-operator

The openGauss-operator uses the client-go library to develop a custom controller monitoring, scheduling and updating openGauss cluster in kubernetes.

Table of Content

1. Build & Run

Deploy Prometheus Monitoring

Use prometheus to monitor the pod and node status.

Follow kube-prometheus quick start to install prometheus stack.

Generate code

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
Deploy OpenGauss controller

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

2. Structure

data flow and logic graph


components


3. Develop

Contributions
  1. modify
  2. git checkout -b xxx
  3. git push origin xxx:feat_xxx
  4. pull request
Use code-generator to update apis

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
client-go under the hood

how the various components in the client-go library work and their interaction points with the custom controller code

grpc code generate

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

Documentation

Overview

This files implements helpful utils to manage components of openGauss.

This files implements helpful utils to manage components of openGauss.

Directories

Path Synopsis
pkg
apis/opengausscontroller/v1
This files implements helpful utils to manage components of openGauss.
This files implements helpful utils to manage components of openGauss.
generated/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
generated/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
generated/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
generated/clientset/versioned/typed/autoscaler/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
generated/clientset/versioned/typed/autoscaler/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
generated/clientset/versioned/typed/opengausscontroller/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
generated/clientset/versioned/typed/opengausscontroller/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
rpc
this file defines formatter for names and attributes used in openGauss-operator
this file defines formatter for names and attributes used in openGauss-operator

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL