# openGauss-controller **Repository Path**: waterme7on/openGauss-controller ## Basic Information - **Project Name**: openGauss-controller - **Description**: openGauss controller watches openGauss cluster in kubernetes and schedules them. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-04-07 - **Last Updated**: 2021-05-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # openGauss-controller The openGauss-controller uses the [client-go](https://github.com/kubernetes/client-go) library to develop a custom controller monitoring, scheduling and updating openGauss cluster in kubernetes. ### Table of Content - [Build & Run](#Build-&-Run) - [Structure](#Structure) - [Develop](#Develop) ## Build & Run ### Deploy Prometheus Monitoring Use prometheus to monitor the pod and node status. Follow [kube-prometheus quick start](https://github.com/prometheus-operator/kube-prometheus#quickstart) to install prometheus stack. ### Deploy OpenGauss controller Fetch the project ``` git clone https://github.com/waterme7on/openGauss-controller.git cd openGauss-controller ``` Build and Run ``` go build -o controller . # kubeconfig won't be needed if run in-cluster ./controller -kubeconfig=$HOME/.kube/config ``` 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 kubect get all | grep opengauss ``` ## Structure ![](./docs/diagrams/operator.png)
## Develop ### Use code-generator to update apis Use [code-generator](https://github.com/kubernetes/code-generator) to update code if you want to modify openGauss apis. You may need to manually install [code-generator](https://github.com/kubernetes/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](https://github.com/kubernetes/sample-controller/blob/master/docs/controller-client-go.md) how the various components in the [client-go](https://github.com/kubernetes/client-go) library work and their interaction points with the custom controller code ![](./docs/diagrams/client-go-controller-interaction.jpeg)