Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoshet committed Oct 17, 2024
1 parent 3ee1a25 commit eeffb26
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 2 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Nick Nikitas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
132 changes: 130 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,131 @@
# PVC-SNAPSHOTTER
<h1 align="center">PVC-Snapshotter</h1>
<div align="center">
<strong>
A Rust 🦀 tool supports PVC snapshots across Kubernetes namespaces (Velerust/Rustero)
</strong>
</div>

Rust tool that supports PVC snapshots across Kubernetes namespaces (Velerust/Rustero)
<br />

<div align="center">
<!-- Github Actions -->
<a href="https://github.com/nikoshet/pvc-snapshotter/actions/workflows/ci.yaml?query=branch%3Amain">
<img src="https://img.shields.io/github/actions/workflow/status/nikoshet/pvc-snapshotter/ci.yaml?branch=main&style=flat-square" alt="actions status" /></a>
<!-- Version -->
<a href="https://crates.io/crates/pvc-snapshotter">
<img src="https://img.shields.io/crates/v/pvc-snapshotter.svg?style=flat-square"
alt="Crates.io version" /></a>
<!-- Docs -->
<a href="https://docs.rs/pvc-snapshotter">
<img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square" alt="docs.rs docs" /></a>
<!-- Downloads -->
<a href="https://crates.io/crates/pvc-snapshotter">
<img src="https://img.shields.io/crates/d/pvc-snapshotter.svg?style=flat-square" alt="Download" />
</a>
</div>

## Overview
The PVC-Snapshotter Tool is a Rust-based utility that allows Kubernetes users to backup and restore Persistent Volume Claim (PVC) snapshots. The tool provides robust mechanisms to back up data to AWS Elastic Block Store (EBS) and restore it to any Kubernetes namespace. This tool is designed to work with Kubernetes VolumeSnapshot resources, making backup and restoration operations seamless.

The tool supports three primary modes of operation:

Backup: Create snapshots of one or more PVCs.
Restore: Restore PVCs from existing snapshots.
Full: Run both backup and restore operations in a single process.


<br>
> [!NOTE]
> Average percentage of time saved by PVC-Snapshotter compared to [Velero](https://github.com/vmware-tanzu/velero): **X%**.
<br>
## Features
- **Backup**: Create Kubernetes VolumeSnapshots from existing PVCs
- **Restore**: Restore PVCs to any namespace from a VolumeSnapshot
- **Flexible Configuration**: The user can either snapshot a specific PVC, or all the PVCs in a specific namespace using the relative flags
- **AWS EBS Integration**: Natively supports backup and restoration to AWS Elastic Block Store
- **Conditional Compilation**: Enable or disable specific modes (backup, restore, full) via Rust feature flags, optimizing binary size and performance.
- **Error Handling**: Robust error handling and retries to ensure operations complete reliably

## Prerequisites
Before using PVC-Snapshotter, please ensure you have the following:
- You need Rust installed to compile the tool. Install Rust via rustup
- An AWS Account with the appropriate access policy
- AWS EBS CSI Driver: Required to be installed in your Kubernetes cluster, which is a CSI Driver to manage the lifecycle of EBS Volumes
- A snapshot-controller that supports handling the VolumeSnapshot and VolumeSnapshotContent Objects
- A specific VolumeSnapshotClass for the CSI driver
- Kubernetes CLI

## Installation (Client)
In order to use the tool as a client, you can use `cargo`.

The tool provides 3 features for running it, which are `backup` `restore`, and `full` (default).
```shell
Usage: pvc-snapshotter-client full [OPTIONS] --source-ns <SOURCE_NS> --target-ns <TARGET_NS> --volume-snapshot-class <VOLUME_SNAPSHOT_CLASS> --volume-snapshot-name-prefix <VOLUME_SNAPSHOT_NAME_PREFIX> --target-snapshot-content-name-prefix <TARGET_SNAPSHOT_CONTENT_NAME_PREFIX> --storage-class-name <STORAGE_CLASS_NAME>

Options:
--region <REGION>
Region where the EBS volumes are stored [default: eu-west-1]
--source-ns <SOURCE_NS>
Source namespace
--target-ns <TARGET_NS>
Target namespace
--volume-snapshot-class <VOLUME_SNAPSHOT_CLASS>
VolumeSnapshotClass name
--pvc-name <PVC_NAME>
PVC name [default: ]
--include-all
Include all PVCs in the namespace
--volume-snapshot-name-prefix <VOLUME_SNAPSHOT_NAME_PREFIX>
VolumeSnapshot name prefix
--target-snapshot-content-name-prefix <TARGET_SNAPSHOT_CONTENT_NAME_PREFIX>
Target VolumeSnapshotContent name prefix
--storage-class-name <STORAGE_CLASS_NAME>
StorageClass name
--vsc-retain-policy <VSC_RETAIN_POLICY>
VSC Retain Policy [default: delete] [possible values: retain, delete]
-h, --help
Print help
-V, --version
Print version
```

## Installation (Library)
Run the tool:
- For **full** mode:
```
cargo run full
```

- For **backup** mode:
```
cargo run --no-default-features --features backup -- backup
```

- For **restore** mode:
```
cargo run --no-default-features --features restore -- restore
```

## Example

- Build and run the Rust tool
```shell
cargo fmt --all
cargo clippy --all

cargo build

RUST_LOG=info \
cargo run full \
--source-ns "source-ns" \
--target-ns "target-ns" \
--volume-snapshot-class "volumesnapshotclass-name" \
--include-all \
--volume-snapshot-name-prefix "prefix-vs" \
--target-snapshot-content-name-prefix "prefix-vsc" \
--storage-class-name "ebs-test-sc"
```

## License
This project is licensed under the MIT License

0 comments on commit eeffb26

Please sign in to comment.