AmberApp is a K8s native framework for application consistency that can work together with Velero and other backup solutions. It will lock databases when backup PVCs.
-
Clone the repo
git clone [email protected]:jibudata/amberapp.git
-
Enter the repo and run
kubectl apply -f deploy
# | Type | Databases required | lock method | description |
---|---|---|---|---|
1. | PostgreSQL | y | pg_start_backup | no impact on CRUD |
2. | MongoDB | n | fsync lock | lock all DBs in current user, db modify operatrion will hang until unquiesced |
3. | MySQL | y | FLUSH TABLES WITH READ LOCK | lock all DBs, cannot create new table, insert or modify data until unquiesced |
-
Clone repo, do install as above, run
make
to build binaries -
Deploy an example application: wordpress, refer to https://github.com/jibutech/docs/tree/main/examples/workload/wordpress
-
Create an hook to MySQL database. NOTE: use
WATCH_NAMESPACE
to specify the namespace where amberapp operator is installed.# export WATCH_NAMESPACE=amberapp-system # bin/apphook create -n test -a mysql -e "wordpress-mysql.wordpress" -u root -p passw0rd --databases mysql # kubectl get apphooks.ys.jibudata.com -n amberapp-system test-hook NAME AGE CREATED AT PHASE test-hook 8s 2021-10-20T12:26:28Z Ready
-
Quiesce DB:
# bin/apphook quiesce -n test -w # kubectl get apphooks.ys.jibudata.com -n amberapp-system test-hook test-hook 18m 2021-10-20T12:26:28Z Quiesced
-
Unquiesce DB:
# bin/apphook unquiesce -n test # kubectl get apphooks.ys.jibudata.com -n amberapp-system test-hook test-hook 18m 2021-10-20T12:26:28Z Unquiesced
-
Delete hook:
# bin/apphook delete -n test
Other backup solution can use CR for API level integration with AmberApp, below are CR details.
Param | Type | Supported values | Description |
---|---|---|---|
AppProvider | string | Postgres / Mongodb / MySql | DB type |
EndPoint | string | serviceName.namespace | Endpoint to connect the applicatio service |
Databases | []string | any | database name array |
OperationType | string | quiesce / unquiesce | |
TimeoutSeconds | *int32 | >=0 | timeout of operation |
Secret | corev1.SecretReference | name: xxx, namespace: xxx | Secret to access the database |
status | Description |
---|---|
Created | CR is just created with operationType is empty. This status is short, as manager is connecting and will update the status to ready/not ready |
Ready | driver manager connected to database successfully. only in Ready status, user can do quiesce operation |
Not Ready | driver manager failed to connect database. user need to check the spec and fill the correct info |
Quiesce In Progress | driver is trying to quiesce database |
Quiesced | databases are successfully quiesced |
Unquiesce In Progress | driver is trying to unquiesce database |
Unquiesced | databases are successfully unquiesced |
-
generate all resources
make generate-all -e VERSION=0.0.4
-
build docker image
make docker-build -e VERSION=0.0.4
-
deploy
make deploy -e VERSION=0.0.4