|
1 | 1 | # DBaaS Operator
|
2 | 2 |
|
3 |
| -This operator is meant to be used as a replacement for the ansible service broker and https://github.com/amazeeio/dbaas-mariadb-apb to run in Kubernetes. |
| 3 | +This set of controllers is meant to be used as a replacement for the ansible service broker and https://github.com/amazeeio/dbaas-mariadb-apb to run in Kubernetes. |
| 4 | + |
| 5 | +It allows for provisiong and deprovisioning of shared MySQL/MariaDB, PostgreSQL, and MongoDB databases. |
4 | 6 |
|
5 | 7 | ## Components
|
| 8 | +### MariaDB/MySQL |
6 | 9 | * MariaDBProvider - These contain the core connection details for a specific provider (AWS RDS, Azure DB for MySQL, etc)
|
7 | 10 | * MariaDBConsumer - These contain the specific connection details for a consumer, multiple consumers can be defined in the one namespace and each will get their own specific service endpoints created pointing to the provider.
|
8 | 11 |
|
9 |
| -# Developing |
10 |
| -## Install Kubebuilder |
11 |
| -``` |
12 |
| -os=$(go env GOOS) |
13 |
| -arch=$(go env GOARCH) |
| 12 | +### PostgreSQL |
| 13 | +* PostgreSQLProvider - These contain the core connection details for a specific provider (AWS RDS primarily or generic postgresql, other cloud providers currently untested) |
| 14 | +* PostgreSQLConsumer - These contain the specific connection details for a consumer, multiple consumers can be defined in the one namespace and each will get their own specific service endpoints created pointing to the provider. |
14 | 15 |
|
15 |
| -# download kubebuilder and extract it to tmp |
16 |
| -curl -L https://go.kubebuilder.io/dl/2.2.0/${os}/${arch} | tar -xz -C /tmp/ |
17 |
| -
|
18 |
| -# move to a long-term location and put it on your path |
19 |
| -# (you'll need to set the KUBEBUILDER_ASSETS env var if you put it somewhere else) |
20 |
| -sudo mv /tmp/kubebuilder_2.2.0_${os}_${arch} /usr/local/kubebuilder |
21 |
| -export PATH=$PATH:/usr/local/kubebuilder/bin |
22 |
| -``` |
| 16 | +### MongoDB |
| 17 | +* MongoDBProvider - These contain the core connection details for a specific provider (Works with AWS DocumentDB, or generic MongoDB with authentication) |
| 18 | +* MongoDBConsumer - These contain the specific connection details for a consumer, multiple consumers can be defined in the one namespace and each will get their own specific service endpoints created pointing to the provider. |
23 | 19 |
|
24 | 20 | ## Test It Out
|
25 |
| -This will spin up a local mysql provider, and then start kind and installs the operator and runs some basic tests to confirm the operation of the operator |
| 21 | +This will spin up a local mysql, postgresql, and mongodb provider. A kind cluster is started, and the operator is installed, then some basic tests are performed to confirm the providers and consumer provisioning and deprovisioning is successful. |
| 22 | + |
| 23 | +### Using circleci locally |
| 24 | +Install the `circleci` tool locally and run the following |
26 | 25 |
|
27 |
| -Using circleci locally |
28 | 26 | ```
|
| 27 | +make local-circle |
| 28 | +# or |
29 | 29 | circleci build -v $(pwd):/workdir
|
30 | 30 | ```
|
31 | 31 |
|
| 32 | +### Running the tests directly |
32 | 33 | ```
|
33 | 34 | make operator-test
|
34 |
| -
|
35 | 35 | # if at anypoint you need to clean up
|
36 | 36 | make clean
|
37 | 37 | ```
|
38 | 38 |
|
39 |
| -# Other |
40 |
| -## Dashboard |
41 |
| -``` |
42 |
| -kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta6/aio/deploy/recommended.yaml |
43 |
| -kubectl apply -f test-resources/dashboard-rbac.yaml |
44 |
| -kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}') |
45 |
| -kubectl proxy |
46 |
| -``` |
47 |
| - |
48 | 39 | ## Code references
|
49 | 40 |
|
50 |
| -* Most of the logic for the operator is in `controllers/` |
51 |
| -* Spec definitions are in `api/v1/*_types.go` |
| 41 | +* Most of the logic for the controllers located in `controllers/<mariadb/postgres/mongodb>/` |
| 42 | +* Spec definitions are in `api/<mariadb/postgres/mongodb>/v*/*_types.go` |
52 | 43 |
|
53 | 44 | ## Config samples
|
54 | 45 |
|
55 | 46 | * located in `config/samples`
|
56 | 47 |
|
57 |
| -# Update Helm Charts |
| 48 | +# Updating Helm Charts |
| 49 | + |
| 50 | +* Update Helmchart and increase version in `Chart.yaml` and `values.yaml` as required |
| 51 | +* run `helm package charts/dbaas-operator -d charts/` |
| 52 | +* run `helm package charts/mariadbprovider -d charts/` |
| 53 | +* run `helm package charts/postgresqlprovider -d charts/` |
| 54 | +* run `helm package charts/mongodbprovider -d charts/` |
| 55 | +* run `helm repo index charts` |
| 56 | + |
| 57 | +# Developing |
| 58 | +## Install Kubebuilder |
| 59 | +``` |
| 60 | +os=$(go env GOOS) |
| 61 | +arch=$(go env GOARCH) |
| 62 | +
|
| 63 | +# download kubebuilder and extract it to tmp |
| 64 | +curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.2.0/kubebuilder_2.2.0_${os}_${arch}.tar.gz | tar -xz -C /tmp/ |
58 | 65 |
|
59 |
| -* Update Helmchart and increase version in `Chart.yaml` |
60 |
| -* run `helm package charts/dbaas-operator -d charts/` and `helm package charts/mariadbprovider -d charts/` |
61 |
| -* run `helm repo index charts` |
| 66 | +# move to a long-term location and put it on your path |
| 67 | +# (you'll need to set the KUBEBUILDER_ASSETS env var if you put it somewhere else) |
| 68 | +sudo mv /tmp/kubebuilder_2.2.0_${os}_${arch} /usr/local/kubebuilder |
| 69 | +export PATH=$PATH:/usr/local/kubebuilder/bin |
| 70 | +``` |
| 71 | + |
| 72 | +# Other |
| 73 | +## Dashboard |
| 74 | +``` |
| 75 | +kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta6/aio/deploy/recommended.yaml |
| 76 | +kubectl apply -f test-resources/dashboard-rbac.yaml |
| 77 | +kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}') |
| 78 | +kubectl proxy |
| 79 | +``` |
0 commit comments