amberapp

command module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

README

AmberApp

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.

overview

Installation

  1. Clone the repo

    git clone git@github.com:jibudata/amberapp.git

  2. Enter the repo and run

    kubectl apply -f deploy

Supported databases

# 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
MySQL > 8.0 y LOCK INSTANCE FOR BACKUP lock current DB, Cannot create, rename or, remove records. Cannot repair, truncate and optimize tables. Can perform DDL operations hat only affect user-created temporary tables. Can create, rename, remove temporary tables. Can create binary log files.
4. Redis >= 2.4 n - standalone and cluster mode support for now, no impact on CRUD, use bgsave for rbd snapshot or disable auto aof rewrite before backup to guarantee consistent aof log

Usage

CLI example
  1. Clone repo, do install as above, run make to build binaries

  2. Deploy an example application: wordpress, refer to https://github.com/jibutech/docs/tree/main/examples/workload/wordpress

  3. 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
    
  4. 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
    
  5. 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
    
  6. Delete hook:

    # bin/apphook delete -n test
    
Use CR

Other backup solution can use CR for API level integration with AmberApp, below are CR details.

CR spec
Param Type Supported values Description
appProvider string Postgres / Mongodb / MySql / Redis 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
params map[string]string mysql-lock-method: table, mysql-lock-method: instance additional parameters for Mysql DB operation
redis-backup-method: rdb, redis-backup-method: aof additional parameters for Redis DB operation
Status
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

Development

  1. generate all resources

    make generate-all -e VERSION=0.1.0
    
  2. build docker image

    make docker-build -e VERSION=0.1.0
    

    multiple arch image

    make docker-pushx -e VERSION=0.1.0
    
  3. deploy

    make deploy -e VERSION=0.1.0
    

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the v1alpha1 API group +kubebuilder:object:generate=true +groupName=ys.jibudata.com
Package v1alpha1 contains API Schema definitions for the v1alpha1 API group +kubebuilder:object:generate=true +groupName=ys.jibudata.com
cmd
pkg
cmd

Jump to

Keyboard shortcuts

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