Developer tips, tricks, and workflows for the rancher/backup-restore-operator.
To test your local changes, cd
to the root of the cloned repository, and execute the following commands:
helm install --wait \
--create-namespace -n cattle-resources-system \
rancher-backup-crd ./charts/rancher-backup-crd
helm install --wait \
-n cattle-resources-system \
rancher-backup ./charts/rancher-backup
For help with setting up the environment, check out /scripts/deploy
. It has some helpful functions for deploying the various components used in the development environment.
To see all available options, run ./scripts/deploy
.
Once your development environment has been set up (i.e. have a cluster up and running), start with exporting the kubeconfig file. From there you can deploy Minio onto the cluster and then backup-restore. Once both charts have been installed you can create a backup.
export KUBECONFIG=`pwd`/kubeconfig.yaml
./scripts/deploy minio
./scripts/deploy backup-restore
./scripts/deploy create-backup
Some changes done to the chart must be packaged into a new docker image. The difficulty with deploying the updated image is that it must be imported to each node and pulled from the local container registry. A workaround is to publish the image to a public docker repo and point the chart to the new image repo. This is handled in the deploy script and can be done using a simple command flow. To publish through our script you must have your docker hub username exported to be used for the repo.
export DOCKERHUB_USER=[your username here]
make build
make package
./scripts/deploy publish
./scripts/deploy minio
./scripts/deploy backup-restore
./scripts/deploy create-backup
Note: if DOCKERHUB_USER
is exported then the script will set the image repo to pull from your dockerhub, if not it will use the Public Rancher image instead.
If you want to interact with the Minio deployed in the cluster, you can use the following arguments:
list-minio-files
: List all the files currently stored in the bucketrancherbackups
in Minioretrieve-minio-files
: Copy all the files currently stored in the bucketrancherbackups
in Minio to the local directoryminio-files-$EPOCH
copy-minio-files
: Copy all the files currently stored in a local directory (passed as first argument) to the bucketrancherbackups
in Minioreset-minio-bucket
: Delete and create therancherbackups
bucket
Currently we only support building this chart for amd64 nodes. The binary built by make build
is set to build for amd64 and we have also included a flag for users running different architectures when trying to package the code into a docker image. Setting USE_DOCKER_BUILDX=1
will force the package script to use docker buildx, setting the target platform to build for amd64. If you do not have docker-buildx
installed please reference this page.
Follow the uninstallation instructions in README.md.